All language subtitles for 4. Check if a number is double-digit or triple-digit - Solution

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,480 --> 00:00:01,710 So welcome back. 2 00:00:01,740 --> 00:00:10,170 My name is Vlad, they self attack and let's solve our previous exercise that you should have tried 3 00:00:10,170 --> 00:00:11,220 solving on your own. 4 00:00:11,670 --> 00:00:16,160 And now once you're done, let's do this exercise together. 5 00:00:16,950 --> 00:00:20,460 So first of all, what we need to do is to create some no. 6 00:00:20,460 --> 00:00:20,760 Right. 7 00:00:20,790 --> 00:00:30,870 What we are checking is simply if a given no, if a given number is double digit or if it is a triple 8 00:00:30,870 --> 00:00:39,630 digit, triple digit, triple digit or if a given number is neither of them. 9 00:00:39,720 --> 00:00:40,060 Right. 10 00:00:40,350 --> 00:00:42,030 So that's what we want to check out. 11 00:00:42,420 --> 00:00:45,060 So for that, let's create our variable. 12 00:00:45,870 --> 00:00:49,540 And this variable is going to be, let's say, no. 13 00:00:49,900 --> 00:00:59,810 OK, now we are going to print nice message for the user to the screen, so please enter a number. 14 00:01:00,000 --> 00:01:08,640 OK, and now we are going to release information using percentage since we are working with integers 15 00:01:08,880 --> 00:01:12,210 and stories inside the address of variable number. 16 00:01:13,110 --> 00:01:14,250 OK, good. 17 00:01:14,700 --> 00:01:20,910 Now, once we have the variable number, we should start thinking of what should be the conditions to 18 00:01:20,910 --> 00:01:25,120 print if it's a double digit, triple digit or neither of them. 19 00:01:25,800 --> 00:01:32,070 So one thing that you need to understand is that all the numbers, let's say we are even talking just 20 00:01:32,070 --> 00:01:33,340 about the positive numbers. 21 00:01:33,360 --> 00:01:38,010 OK, so it's going like this one, two or three, so on and so forth. 22 00:01:38,640 --> 00:01:47,840 And there is a point when you reach 10 and then you go like 11, 12 and so on and you reach ninety nine, 23 00:01:48,720 --> 00:01:58,050 ninety nine, then you have your one hundred, one hundred and one and so on up until nine hundred nineteen 24 00:01:58,050 --> 00:01:59,160 point ninety nine. 25 00:01:59,190 --> 00:02:03,850 OK now afterwords you have one thousand, one thousand and one and so on. 26 00:02:04,170 --> 00:02:12,360 So that's basically if we take a look at all the natural numbers from one up to, I don't know, two 27 00:02:12,360 --> 00:02:13,620 very large numbers. 28 00:02:14,370 --> 00:02:16,500 And what what's special about it? 29 00:02:16,500 --> 00:02:21,860 If you take a look at these sequence of numbers, what can you conclude out of it? 30 00:02:21,870 --> 00:02:31,170 What can you see what patterns are like are feasible for for you maybe that are basically that we are 31 00:02:31,170 --> 00:02:33,810 talking just about positive numbers and that's OK. 32 00:02:33,840 --> 00:02:36,480 OK, because we could also use negative numbers. 33 00:02:36,480 --> 00:02:41,540 But in this example for simplicity, I would only use positive numbers. 34 00:02:41,820 --> 00:02:51,000 So the question here is, if we see one, two, three and then 10, 11, 12, the data and so on, what 35 00:02:51,000 --> 00:02:58,980 you should notice is basically some condition that says if it's two digits number, OK, if it's a two 36 00:02:58,980 --> 00:03:03,470 digit number, there are a couple of options, a couple of conditions to check that. 37 00:03:03,960 --> 00:03:06,240 And the first condition is very simple. 38 00:03:06,240 --> 00:03:07,230 It goes like this. 39 00:03:07,230 --> 00:03:18,570 If number is greater then than what we think about it, then 11 or 10, what should it be if it's greater 40 00:03:18,570 --> 00:03:22,140 or equal to ten or right. 41 00:03:22,290 --> 00:03:30,390 Or the logical operator or or is it less than or equal to 99? 42 00:03:30,900 --> 00:03:38,300 Then in this case, we can definitely say that this number is a double digit number. 43 00:03:38,340 --> 00:03:38,700 Right? 44 00:03:38,970 --> 00:03:46,470 This number is a double digit double that's go. 45 00:03:46,710 --> 00:03:51,900 This is a double digit number. 46 00:03:52,290 --> 00:03:52,740 Right. 47 00:03:53,520 --> 00:03:57,630 So this number has to digitize. 48 00:03:58,470 --> 00:04:05,310 And this condition is true because if the number and we know we work with integers is greater than 10 49 00:04:05,310 --> 00:04:11,400 or equal to ten or is less than or equal to 99, then it means it's in this range. 50 00:04:11,430 --> 00:04:13,710 OK, so it's from 10 up to ninety nine. 51 00:04:13,710 --> 00:04:19,620 And you can see that all the numbers here, all the integers, the natural numbers are from 10 up to 52 00:04:19,620 --> 00:04:20,500 99. 53 00:04:21,780 --> 00:04:23,970 OK, so that's one way to solve it. 54 00:04:23,970 --> 00:04:30,360 I'm not sure that I will show you all the ways, but let's just proceed with this exercise or else OK 55 00:04:30,480 --> 00:04:38,150 else else if what is the second thing that we need to check if it's a triple digit. 56 00:04:38,160 --> 00:04:38,590 Right. 57 00:04:38,610 --> 00:04:44,060 So if the number is greater or equal to 800. 58 00:04:44,190 --> 00:04:44,660 Right. 59 00:04:44,670 --> 00:04:53,280 The first leftmost, let's say, smallest triple digit number or the number is less than or equal to 60 00:04:53,550 --> 00:04:56,220 two what, two if thousand or two. 61 00:04:56,220 --> 00:04:57,520 Nine hundred ninety nine. 62 00:04:57,930 --> 00:04:59,820 So since we are using lisick. 63 00:04:59,910 --> 00:05:06,390 Well, is he saying we should take just nine hundred ninety nine, so if that's the range in this case, 64 00:05:06,390 --> 00:05:13,400 we should simply print that this number is a triple digit number, so triple digit number also. 65 00:05:14,220 --> 00:05:23,430 But if it was not in invis range from 10 up to 99 and also it was not in the range from one hundred 66 00:05:23,550 --> 00:05:28,890 up to 999, then in this case, what should we do? 67 00:05:29,250 --> 00:05:30,300 What should we do this? 68 00:05:30,480 --> 00:05:38,240 Should we print some last message or or and I'm just just giving you some time to think about it. 69 00:05:38,940 --> 00:05:40,670 Is this condition OK? 70 00:05:40,680 --> 00:05:43,130 Is this logical operator is OK? 71 00:05:43,170 --> 00:05:51,030 I mean, if you didn't stop to think about it, at least for a moment, if this condition is OK or not, 72 00:05:51,330 --> 00:05:58,770 then probably you have you have to change a little bit your attitude for these exercises in these course, 73 00:05:59,100 --> 00:06:06,480 because a lot of things that I say you don't have not neither are the things that I say and nor the 74 00:06:06,480 --> 00:06:08,550 things that your teacher says. 75 00:06:08,850 --> 00:06:11,640 Don't take everything just as granted. 76 00:06:11,700 --> 00:06:12,990 OK, think about it. 77 00:06:12,990 --> 00:06:19,450 Think about what I've written here, because I've made some mistake here and I've used the logical operator 78 00:06:19,450 --> 00:06:22,830 or OK, and I just went with the exercise. 79 00:06:22,830 --> 00:06:23,870 Is everything okay? 80 00:06:24,780 --> 00:06:27,570 So basically that's not okay. 81 00:06:27,660 --> 00:06:28,680 And why is that? 82 00:06:29,550 --> 00:06:36,000 What will be the case and what will be printed if we simply received here, for example, let's say 83 00:06:36,120 --> 00:06:37,650 now equals to five. 84 00:06:37,890 --> 00:06:39,690 OK, so not equal to five. 85 00:06:40,080 --> 00:06:48,660 So if NUM is greater or equal to ten, this is false or Nahmias less than or equal to 99. 86 00:06:48,870 --> 00:06:50,670 This will be probably truer. 87 00:06:50,670 --> 00:06:54,150 Right, because five is less than or equal to 99. 88 00:06:54,390 --> 00:06:58,620 Then in this case we will have this number is a double digit number. 89 00:06:58,740 --> 00:07:01,500 We will have this this message printed to the screen. 90 00:07:02,100 --> 00:07:03,270 That's not the case. 91 00:07:03,270 --> 00:07:06,360 That's not what we want since we know this number is one digit. 92 00:07:06,720 --> 00:07:13,350 And also what will be the case for one thousand and five, we will see that this condition happens to 93 00:07:13,350 --> 00:07:14,010 be true. 94 00:07:14,370 --> 00:07:14,880 Right. 95 00:07:15,030 --> 00:07:23,490 But it shouldn't be true because we should not let 1005 be printed as a double digit number, because 96 00:07:23,490 --> 00:07:24,630 that's not the case. 97 00:07:25,530 --> 00:07:33,690 So pay close attention to what you are being taught and always be kind of curious about whether what 98 00:07:33,690 --> 00:07:35,070 you've heard is true. 99 00:07:35,100 --> 00:07:41,220 Or maybe the teacher has done some mistake, sometimes on purpose, sometimes not on purpose. 100 00:07:41,730 --> 00:07:49,020 So what my what I said just use simply always be very like very paying attention. 101 00:07:49,440 --> 00:07:55,950 And here, if we go back to the exercise, what we need to do is to kind of make sure that 102 00:07:58,350 --> 00:08:02,820 basically previously, if we take a look now, is greater or equal to 210. 103 00:08:02,940 --> 00:08:06,480 It goes like from ten to all the numbers on it's right. 104 00:08:06,480 --> 00:08:10,650 If it will be either of these numbers, the condition will return. 105 00:08:10,650 --> 00:08:11,040 True. 106 00:08:11,340 --> 00:08:18,090 And also if it will be less than 99, up to whatever numbers will come, even if there will be negative, 107 00:08:18,120 --> 00:08:19,290 it will be also true. 108 00:08:19,560 --> 00:08:26,190 So what we want to do is to limit the range from ten to ninety nine, just these range. 109 00:08:26,190 --> 00:08:30,710 And that's something you can do by using the logical end operator. 110 00:08:30,720 --> 00:08:33,990 So the numbers should be great or equal to ten. 111 00:08:34,320 --> 00:08:39,120 And also it should be less than or equal to a ninety nine. 112 00:08:39,690 --> 00:08:45,330 So that's how you change it, that's how you pay attention to the small details and that's basically 113 00:08:45,330 --> 00:08:49,320 the difference in the exercise and in the solution. 114 00:08:49,680 --> 00:08:53,250 So we can say that, 115 00:08:56,340 --> 00:08:58,290 that that's the first. 116 00:08:59,380 --> 00:09:04,870 The first section that's the first section of the two digit numbers, that's the second section of the 117 00:09:04,870 --> 00:09:06,140 three digits number. 118 00:09:06,460 --> 00:09:12,970 And finally, we will say that if it's not in this section and also it's not in this section, then 119 00:09:12,970 --> 00:09:15,340 we definitely can bring the following line. 120 00:09:15,670 --> 00:09:18,850 So Printout, what was it? 121 00:09:20,170 --> 00:09:30,390 Neither of these number is neither, let's say double digit nor triple digit. 122 00:09:31,390 --> 00:09:31,860 Right. 123 00:09:34,150 --> 00:09:34,680 Digit. 124 00:09:35,480 --> 00:09:44,570 OK, so it may be less than 10 and also it may be greater than a thousand, OK? 125 00:09:44,590 --> 00:09:46,370 Greater or equal to a thousand. 126 00:09:46,600 --> 00:09:52,150 So that's basically how we solve this exercise and let's build and run it to see that everything is 127 00:09:52,150 --> 00:09:53,440 working as expected. 128 00:09:53,470 --> 00:09:54,850 So please enter a no. 129 00:09:54,850 --> 00:09:55,380 What was it. 130 00:09:55,380 --> 00:09:56,220 Twenty two. 131 00:09:56,530 --> 00:09:58,830 So this number is a double digit number. 132 00:09:58,990 --> 00:10:00,490 Let's enter the next one. 133 00:10:00,600 --> 00:10:06,220 Let's to one hundred and one triple digit and also let's use it with five. 134 00:10:06,610 --> 00:10:10,480 So this number is neither a double digit nor triple digit. 135 00:10:10,930 --> 00:10:14,320 And finally, let's use, I don't know, something like this. 136 00:10:14,740 --> 00:10:22,140 So this is also not a digit or a double digit nor triple digit number. 137 00:10:22,870 --> 00:10:28,120 So I think this condition is very simple to find the section that you are interested in. 138 00:10:28,150 --> 00:10:35,980 Also, you may also find if this number consists just of one digit, the condition is going to be pretty 139 00:10:35,980 --> 00:10:36,660 much the same. 140 00:10:37,180 --> 00:10:41,290 And yeah, basically this is it for this kind of solution. 141 00:10:42,160 --> 00:10:52,390 But of course, there are also additional solutions where you can use just the just using the division 142 00:10:52,390 --> 00:10:56,120 operation and dividing your number, for example, by 10. 143 00:10:56,500 --> 00:11:03,400 OK, and if you are getting some result that these in some reasonable range, that then you can assume 144 00:11:03,400 --> 00:11:09,310 that your number is a double digit number or if you divide it by one hundred and then you receive some 145 00:11:09,310 --> 00:11:16,720 value, which is in the range from from one to nine, then you can assume that this number is a triple 146 00:11:16,720 --> 00:11:17,110 digit. 147 00:11:17,290 --> 00:11:22,120 But that's a whole different condition and that's basically a different program. 148 00:11:22,120 --> 00:11:23,730 Both of them will work. 149 00:11:23,890 --> 00:11:26,440 But this was just the first option. 150 00:11:26,530 --> 00:11:28,600 You can try the second option on your own. 151 00:11:28,960 --> 00:11:31,590 And yeah, this is it for this video, guys. 152 00:11:31,630 --> 00:11:32,920 Thank you so much for watching. 153 00:11:32,950 --> 00:11:36,070 Keep on practicing and I will see you in the next videos. 14492

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