All language subtitles for 13. Chars To 3 Digits Integer

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,510 --> 00:00:09,060 So welcome, and in the previous video, we started to talk about different of exercises that we're 2 00:00:09,090 --> 00:00:18,420 using, but we're using ASCII characters and in this video we will continue OK, and we will create 3 00:00:18,420 --> 00:00:25,700 a new function that will also work a little bit with ASCII representations. 4 00:00:26,520 --> 00:00:28,090 So let us start. 5 00:00:29,010 --> 00:00:36,180 So what we have to say first is that we know that there may be a lot of different characters, like 6 00:00:36,640 --> 00:00:48,720 a lower case, a lower case, B, OK, lower case, lower case B, uppercase F, we have characters 7 00:00:48,720 --> 00:00:49,560 like this. 8 00:00:49,560 --> 00:00:51,750 We have characters like that. 9 00:00:52,500 --> 00:00:52,820 Right. 10 00:00:52,850 --> 00:00:58,050 There are many, many, many characters that we can use the results of a character, which is a space 11 00:00:58,050 --> 00:01:00,030 character and so on. 12 00:01:00,760 --> 00:01:07,590 And also what we know that there are characters which are simply represented as digits. 13 00:01:07,800 --> 00:01:14,520 OK, so there is one which is also a character or two, which is also a character and so on. 14 00:01:14,520 --> 00:01:16,860 Up until zero and nine. 15 00:01:16,860 --> 00:01:18,860 Right, there is nine character. 16 00:01:18,990 --> 00:01:25,350 If you take a look on your keyboard, you will also see the zero character, right? 17 00:01:25,370 --> 00:01:27,120 So there are many characters. 18 00:01:27,120 --> 00:01:32,800 Of course, one hundred at least one is not a character that's a string. 19 00:01:32,860 --> 00:01:35,490 It's something I think we haven't spoke of so far. 20 00:01:35,640 --> 00:01:37,680 But that's definitely not a character. 21 00:01:38,580 --> 00:01:46,200 But all of these, they are simply characters and they can be also stora this characters, although 22 00:01:46,200 --> 00:01:54,720 the number the integer one can bestor it is an integer, but here one also can be stored as a character 23 00:01:54,960 --> 00:01:57,120 in the different scene in. 24 00:01:57,180 --> 00:02:05,640 The fact is that you can store one very variable with the value of one as an integer and then it will 25 00:02:05,640 --> 00:02:07,920 consume like four bytes of memory. 26 00:02:07,920 --> 00:02:15,030 And also you can store there's a character to and it will be stored just as a character with consuming 27 00:02:15,030 --> 00:02:16,580 just one bit of memory. 28 00:02:16,830 --> 00:02:18,690 And there is also a difference. 29 00:02:18,690 --> 00:02:24,390 You cannot like add one character to another and expect a fully mathematical operation. 30 00:02:24,420 --> 00:02:24,760 Right. 31 00:02:24,780 --> 00:02:25,940 That's not the case. 32 00:02:25,950 --> 00:02:27,420 It's not how it's going to work. 33 00:02:27,420 --> 00:02:28,630 It's simply stored. 34 00:02:28,630 --> 00:02:31,170 There's a character that you press from your keyboard. 35 00:02:31,370 --> 00:02:31,580 Okay. 36 00:02:31,920 --> 00:02:34,230 So I hope that makes sense so far. 37 00:02:35,010 --> 00:02:39,780 And if we were, we would have taken a look at the ASCII table. 38 00:02:39,780 --> 00:02:48,300 You will see that there is also and ASCII character representation for all the digits from what what 39 00:02:48,300 --> 00:02:48,810 we want. 40 00:02:48,840 --> 00:02:50,180 Let me check. 41 00:02:50,190 --> 00:02:55,320 It was from zero, which is correct. 42 00:02:55,500 --> 00:03:03,990 The representation of zero, which starts from the decimal representation of 48 up until nine character, 43 00:03:04,260 --> 00:03:06,500 which is the representation of fifty seven. 44 00:03:06,510 --> 00:03:14,940 So we know, we know these pretty much that the character is zero corresponds to the decimal representation 45 00:03:14,970 --> 00:03:17,780 of the value of 48 48. 46 00:03:18,090 --> 00:03:25,950 And we know that it goes like this up until the correct representation of nine, which is basically 47 00:03:25,950 --> 00:03:34,180 fifty seven because they are all stored or basically placed one after another in kind of a sequence. 48 00:03:34,220 --> 00:03:36,090 OK, so that's the character. 49 00:03:36,090 --> 00:03:37,050 That's each death. 50 00:03:37,350 --> 00:03:42,510 That's equal representation in in the memory of the computer. 51 00:03:43,660 --> 00:03:44,260 Awesome. 52 00:03:44,350 --> 00:03:48,860 And now what do we have to do is simply to write a function? 53 00:03:48,910 --> 00:03:58,480 OK, so that's our task, to write a function that receives what a child receives, what he should receive. 54 00:03:58,900 --> 00:04:03,160 It should receive three characters, OK, three characters. 55 00:04:03,970 --> 00:04:10,840 And these characters basically should be just numbers and just the digits. 56 00:04:10,870 --> 00:04:20,620 OK, so basically we should also check if the characters are digits or if all the characters are of 57 00:04:20,620 --> 00:04:29,140 a digit type of a digit type, meaning they are from zero up to nine. 58 00:04:29,410 --> 00:04:29,790 Right. 59 00:04:29,800 --> 00:04:39,550 Each character, then in this case the function should return an integer, which is the decimal representation 60 00:04:39,550 --> 00:04:40,370 of this number. 61 00:04:40,390 --> 00:04:54,250 OK, so we should return an integer, which is a decimal representation of this representation of these 62 00:04:54,610 --> 00:04:56,800 three digits number. 63 00:04:57,370 --> 00:05:00,260 So for example, let's use the examples here. 64 00:05:00,280 --> 00:05:13,350 Example, if we would have received like three characters like this one, five and five and nine, then 65 00:05:13,420 --> 00:05:24,220 in this case, what we would have to do is simply to return to where it is here, to return the value 66 00:05:24,250 --> 00:05:28,150 of an integer, a type of one hundred and fifty nine. 67 00:05:28,570 --> 00:05:28,880 OK. 68 00:05:28,900 --> 00:05:32,700 So notice we do not return a character or something like that. 69 00:05:32,980 --> 00:05:36,240 We simply return one fifty nine. 70 00:05:37,000 --> 00:05:49,870 So that's one example, if you would have I don't know, like a two zero and six and six, then in this 71 00:05:49,870 --> 00:05:53,950 case you would have to return like two hundred and six. 72 00:05:54,040 --> 00:05:56,410 OK, so return two hundred and six. 73 00:05:56,680 --> 00:05:59,370 Very simple also. 74 00:05:59,500 --> 00:06:05,460 And basically if one of the characters are which is the otherwise case here. 75 00:06:05,480 --> 00:06:05,820 Right. 76 00:06:05,830 --> 00:06:15,460 If not all the characters are a of a digit type, then what you have to do is simply return zero. 77 00:06:16,240 --> 00:06:23,500 OK, so what I mean by that, if you will receive one character, which is let's say these these characters 78 00:06:23,500 --> 00:06:27,970 are, then definitely you cannot calculate in return some number associated with that. 79 00:06:27,970 --> 00:06:28,250 Right. 80 00:06:28,570 --> 00:06:31,780 So if that's the case, you should simply return zero. 81 00:06:32,470 --> 00:06:35,140 OK, so I hope the instructions are clear to you guys. 82 00:06:35,530 --> 00:06:37,170 Take a few moments to think about it. 83 00:06:37,360 --> 00:06:41,500 And of course, we will solve that exercise together right away. 84 00:06:41,620 --> 00:06:43,810 But please give it a try. 85 00:06:43,810 --> 00:06:44,820 Try it on your own. 86 00:06:44,830 --> 00:06:47,320 Don't jump right away to do the solutions. 87 00:06:47,560 --> 00:06:55,960 Otherwise it will not give you as much knowledge and as much understanding is as you would have done 88 00:06:55,960 --> 00:06:59,250 and tried to solve it by yourself. 89 00:07:00,040 --> 00:07:01,150 So take your time. 90 00:07:01,420 --> 00:07:02,290 No rush. 91 00:07:02,650 --> 00:07:07,600 This video is here and I am going to see you in the solutions. 92 00:07:09,880 --> 00:07:10,390 Awesome. 93 00:07:10,640 --> 00:07:21,930 OK, so once you have tried to solve it on your own, that's a good time to start solving it for ourselves. 94 00:07:22,130 --> 00:07:26,310 OK, so let us start and call these function. 95 00:07:26,380 --> 00:07:26,890 I don't know. 96 00:07:26,890 --> 00:07:29,800 Let's call it character. 97 00:07:30,610 --> 00:07:36,610 Let's call it two digits, not a digital integer. 98 00:07:36,910 --> 00:07:46,000 OK, characters two integer and least function should receive what you did get should get three characters. 99 00:07:46,030 --> 00:07:51,850 So let's say cha cha boom. 100 00:07:52,060 --> 00:07:56,020 Let's say character one char. 101 00:07:56,530 --> 00:07:59,020 Character two and char. 102 00:07:59,620 --> 00:08:01,690 Character three. 103 00:08:02,080 --> 00:08:02,610 All right. 104 00:08:02,620 --> 00:08:04,990 So that's the signature of the function. 105 00:08:05,260 --> 00:08:12,190 And the reason why these function returns an integer is because we said that we want to take the information 106 00:08:12,190 --> 00:08:19,800 stored in each of these characters and to construct a three digit number, which will be of an integer 107 00:08:19,810 --> 00:08:22,570 type and then simply to return it. 108 00:08:23,230 --> 00:08:26,110 So how should we go about that? 109 00:08:26,650 --> 00:08:33,010 So basically what I recommend is to understand, first of all, that we need to check. 110 00:08:33,220 --> 00:08:42,220 OK, we need to check that all of the characters are, first of all, are represented as digits. 111 00:08:42,730 --> 00:08:47,150 And one way to do so is just to use one if condition. 112 00:08:47,170 --> 00:09:03,940 So if let's say if and we will ask director one is greater than zero and character one is less than 113 00:09:03,940 --> 00:09:07,140 or equal to nine, then that's OK, right. 114 00:09:07,180 --> 00:09:07,910 That's OK. 115 00:09:08,410 --> 00:09:13,950 We can also do the same thing for character or two and character three. 116 00:09:14,920 --> 00:09:15,590 Is that clear. 117 00:09:15,610 --> 00:09:17,230 So far, good. 118 00:09:17,590 --> 00:09:22,670 So we can start with just this explanation. 119 00:09:22,690 --> 00:09:31,660 So if character one is greater than zero in character one is less than nine, then it means it's in 120 00:09:31,810 --> 00:09:33,700 the legit range. 121 00:09:34,120 --> 00:09:39,810 So of course, guys, there are plenty of of options to solve this exercise. 122 00:09:39,820 --> 00:09:41,130 I'm going to show you just one. 123 00:09:41,140 --> 00:09:42,030 So no worries. 124 00:09:42,040 --> 00:09:48,270 If you've done it a little bit differently, just make sure that the expected result is pretty much 125 00:09:48,280 --> 00:09:48,900 the same. 126 00:09:50,290 --> 00:09:56,680 So let's create let's create, um, let's create just for simplicity. 127 00:09:57,250 --> 00:09:59,530 We will create three variables. 128 00:09:59,530 --> 00:10:01,030 It's not mandatory, of course. 129 00:10:01,720 --> 00:10:06,520 What we will create three variables and we will say the first variable will be hundreds. 130 00:10:07,450 --> 00:10:10,540 The second variable will be what it should be. 131 00:10:10,750 --> 00:10:15,280 Each should be tense and the third variable is units. 132 00:10:16,090 --> 00:10:20,080 And of course, we will create like a final result. 133 00:10:20,380 --> 00:10:22,280 OK, final result. 134 00:10:22,390 --> 00:10:22,810 Awesome. 135 00:10:23,320 --> 00:10:29,420 So we know that the first character, a character one, is related to the leftmost character. 136 00:10:29,710 --> 00:10:37,390 So in this case, we will simply say that the hundreds will be equal to what do these characters. 137 00:10:37,400 --> 00:10:45,010 So this will represent are the digit, the leftmost digit, which is associated with the hundreds. 138 00:10:45,850 --> 00:10:55,810 So hundreds will be equal to character one minus what, minus the zero representation, which is kind 139 00:10:55,810 --> 00:10:57,380 of the the. 140 00:10:59,060 --> 00:11:07,930 The lowest between all of these characters, from zero to nine, since they are in a 16 sequential manner, 141 00:11:07,940 --> 00:11:12,680 so pretty much just like our examples to lower, into higher, into upper. 142 00:11:13,670 --> 00:11:15,880 We are doing the same thing here. 143 00:11:15,890 --> 00:11:24,320 So if character was like to OK, the character was still so two minus zero would give us a total result 144 00:11:24,320 --> 00:11:30,570 of two and it will be the decimal representation, which is exactly what we want. 145 00:11:30,600 --> 00:11:35,430 OK, so we are going to take a look at ah let's go with this example with this one. 146 00:11:35,750 --> 00:11:38,840 So we are going to take this one character. 147 00:11:38,880 --> 00:11:48,880 OK, the one character, it has a representation, the decimal representation of what it was off of 148 00:11:48,970 --> 00:11:50,950 the day to day of forty nine. 149 00:11:50,960 --> 00:11:56,180 So it's going to be forty nine minus forty eight, which are the decimal representation, which is a 150 00:11:56,180 --> 00:11:56,920 total of one. 151 00:11:56,930 --> 00:11:59,150 So hundreds will be equal to one. 152 00:11:59,300 --> 00:12:08,370 OK, so intolerants equals to one and then we are going to proceed with if of course the ls here the 153 00:12:08,390 --> 00:12:14,900 ls for this condition is return zero and basically and this exercise right it right away. 154 00:12:15,500 --> 00:12:20,630 And then we are going also to do pretty much the same job for a character or two. 155 00:12:20,990 --> 00:12:24,560 So each character or two is greater than zero. 156 00:12:24,570 --> 00:12:32,150 And also if Keryx or two is less than or equal to nine, then in this case we will know that the hundreds 157 00:12:32,480 --> 00:12:41,470 that 100th the test should be equal to character and two minus the decimal representation of character 158 00:12:41,470 --> 00:12:47,050 is zero, which in this case we take these five and we know that 10 will be equal to five. 159 00:12:47,630 --> 00:12:47,950 Right. 160 00:12:49,010 --> 00:12:52,520 And of course, the VLCC is again return zero. 161 00:12:52,790 --> 00:12:58,940 OK, because if one character, at least one character is not in this range from character to zero, 162 00:12:58,940 --> 00:13:01,300 up to nine, that's not something that we want. 163 00:13:01,940 --> 00:13:13,250 And finally, we have also if character character of three is greater than or equal to zero and also 164 00:13:13,250 --> 00:13:20,780 character three is less than or equal to nine, then in this case we will say that the units will be 165 00:13:20,780 --> 00:13:25,640 equal to character, a three minus zero. 166 00:13:26,450 --> 00:13:30,740 OK, guys, in this case it will be simply nine right from this example. 167 00:13:31,370 --> 00:13:36,110 Else return return zero also. 168 00:13:36,210 --> 00:13:43,070 So we found out the hundredth representation, the dance and the units, and we have to return the final 169 00:13:43,070 --> 00:13:48,800 result and the final result should be calculated in the following way. 170 00:13:48,810 --> 00:13:49,940 You know, this is one. 171 00:13:49,970 --> 00:13:50,700 This is five. 172 00:13:50,720 --> 00:13:51,450 This is nine. 173 00:13:51,470 --> 00:13:52,970 So we have to return. 174 00:13:53,270 --> 00:13:57,320 We have to return hundreds multiplied by a hundred. 175 00:13:57,320 --> 00:13:57,710 Right. 176 00:13:58,100 --> 00:14:06,530 Since that's hundreds plus tens multiplied by by what, by 10 and plus units. 177 00:14:07,460 --> 00:14:11,930 OK, so you will go you take this one multiplied by 100. 178 00:14:11,930 --> 00:14:18,530 So it will be 100 plus tens, which is five multiplied by ten, which will give us one hundred and fifty 179 00:14:18,530 --> 00:14:21,530 and plus nine, one hundred and fifty nine. 180 00:14:22,100 --> 00:14:25,610 So that's the characters to integer function. 181 00:14:26,360 --> 00:14:29,420 If you still have any questions, feel free to ask them. 182 00:14:30,260 --> 00:14:40,290 And until the next time, keep on practicing, keep on moving forward and you are bound to succeed hopefully. 183 00:14:40,310 --> 00:14:40,670 Yeah. 184 00:14:41,420 --> 00:14:42,790 I wish you a great day, guys. 185 00:14:42,940 --> 00:14:43,370 Goodbye. 17358

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.