All language subtitles for 2. Congratulations Failed - How should you decide

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
ceb Cebuano
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
hmn Hmong
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
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
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 Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
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,330 --> 00:00:04,590 So when will we want to use conditions in what situations? 2 00:00:05,010 --> 00:00:10,350 Think, for example, that we would like to develop a program that will get your grade on your last 3 00:00:10,350 --> 00:00:10,800 exam? 4 00:00:11,130 --> 00:00:15,000 And suppose you would like to make this program a really cool one. 5 00:00:15,030 --> 00:00:18,060 Such a program that will preened congratulations. 6 00:00:18,060 --> 00:00:19,930 Message to the screen. 7 00:00:19,980 --> 00:00:22,290 If you've actually passed the exam. 8 00:00:22,500 --> 00:00:27,870 But if you didn't pass, meaning that their input rate was insufficient, let's go this way. 9 00:00:28,200 --> 00:00:31,140 You will print a failed try again message. 10 00:00:31,320 --> 00:00:36,090 And I would like you to take a couple of minutes to just think of this question. 11 00:00:36,540 --> 00:00:37,680 Could you accomplish it? 12 00:00:37,710 --> 00:00:40,290 Do you think you can write the code for it? 13 00:00:40,560 --> 00:00:41,880 I mean, right now. 14 00:00:42,060 --> 00:00:42,940 So give it a shot. 15 00:00:42,960 --> 00:00:43,440 Would you? 16 00:00:43,620 --> 00:00:44,730 And once you're back. 17 00:00:44,760 --> 00:00:51,480 Basically what we can see here on the screen is that we have two different programs on the left and 18 00:00:51,480 --> 00:00:52,440 on the right side. 19 00:00:52,620 --> 00:00:56,310 And both of these programs read the input from the user. 20 00:00:56,490 --> 00:01:03,000 And then one of these programs preens congratulations, message to the screen while the other one preens 21 00:01:03,000 --> 00:01:03,640 failed. 22 00:01:03,720 --> 00:01:04,980 Try again, message. 23 00:01:05,370 --> 00:01:09,680 But if you take a look at them separately, they are not so useful. 24 00:01:09,690 --> 00:01:10,070 Right. 25 00:01:10,590 --> 00:01:15,330 That's why we should aim to combine them into just one program. 26 00:01:15,480 --> 00:01:20,040 So we will take the failed DRÉ again message and just move it to the left. 27 00:01:20,160 --> 00:01:22,110 Just added to this program. 28 00:01:22,290 --> 00:01:25,980 And now we have both of these messages just in one place. 29 00:01:26,160 --> 00:01:32,640 But this probably you can see, unfortunately, if we tried to run these program as is. 30 00:01:33,000 --> 00:01:38,190 You will simply see that you're getting an input from the user, which works fine. 31 00:01:38,460 --> 00:01:42,410 And then you just print congratulations as well as failed. 32 00:01:42,430 --> 00:01:43,650 Try again, message. 33 00:01:43,830 --> 00:01:50,100 And that doesn't make any sense, though, to print both of these messages, one after the other. 34 00:01:50,250 --> 00:01:57,030 So, guys, that's exactly why we need some control here in this control is actually something new. 35 00:01:57,030 --> 00:01:59,670 We haven't used it in previous sections. 36 00:02:00,000 --> 00:02:04,200 We didn't see any examples in which we were testing any conditions. 37 00:02:04,530 --> 00:02:12,150 All we were just doing is simply running some lines of code, getting inputs and giving output commands 38 00:02:12,450 --> 00:02:13,860 one after the other. 39 00:02:14,040 --> 00:02:17,880 So how should we add these controlled while program? 40 00:02:18,120 --> 00:02:21,900 And it basically should work like this in both situations. 41 00:02:21,930 --> 00:02:24,270 We will still need to read some inputs. 42 00:02:24,300 --> 00:02:24,710 Right. 43 00:02:24,870 --> 00:02:26,850 So these parties, these a must. 44 00:02:26,940 --> 00:02:29,610 And it has nothing to do with any condition. 45 00:02:29,880 --> 00:02:31,860 And now comes the real question. 46 00:02:32,220 --> 00:02:39,360 How will you print congratulations if they received grade equals or higher than, let's say, 60 and 47 00:02:39,360 --> 00:02:40,890 print a field, try again. 48 00:02:40,890 --> 00:02:44,610 Message if they received rate is below is lower than 60. 49 00:02:44,760 --> 00:02:51,180 So for that, we will need to ask the help of these guy who will be in charge of all the control flow 50 00:02:51,180 --> 00:02:52,400 in our program. 51 00:02:52,590 --> 00:02:58,320 He will decide on what path should we take next based on the result of some condition. 52 00:02:58,470 --> 00:03:01,670 So basically great equals or a higher than 60. 53 00:03:01,770 --> 00:03:04,650 Meaning that the result of this condition is true. 54 00:03:05,070 --> 00:03:10,320 Then we will run the code on the left side and print congratulations message to the screen. 55 00:03:10,560 --> 00:03:12,670 And be very happy about it. 56 00:03:12,870 --> 00:03:18,480 But if the result of the condition is false, we will run the code on the right side and print a failed 57 00:03:18,480 --> 00:03:24,510 try again message and be very, I don't know, unhappy about that, that we failed the test. 58 00:03:24,720 --> 00:03:30,090 So basically all this guy does is simply deciding what parts of code. 59 00:03:30,120 --> 00:03:36,750 What specific commands should be executed based on the result of the given condition. 60 00:03:36,990 --> 00:03:42,990 In this case, it's just if a grade is equals or higher than 60. 61 00:03:43,110 --> 00:03:45,630 So once again, just to make that clear. 62 00:03:45,900 --> 00:03:53,340 If the grade is higher or equals to 60, then we will run the code on the left and print a congratulations 63 00:03:53,340 --> 00:03:54,450 message to the screen. 64 00:03:54,690 --> 00:04:00,960 Otherwise, if the grade is not enough to pass the exam, we will run the code on the right and print 65 00:04:00,960 --> 00:04:01,710 a field. 66 00:04:01,770 --> 00:04:02,910 Try again message. 67 00:04:03,000 --> 00:04:08,070 So now we simply do not print both of the messages as we've done it previously. 68 00:04:08,490 --> 00:04:14,740 We are just executing the relevant part of the code based on the result of this condition. 69 00:04:14,960 --> 00:04:17,100 So this is it for these video guys. 70 00:04:17,190 --> 00:04:23,730 And I really hope that by taking a look at these previous simple example, you've got the point and 71 00:04:23,760 --> 00:04:28,140 the reason why we need to use condition and control flow. 72 00:04:28,300 --> 00:04:34,590 And now let's see how we can take this example and implemented in our programming language. 73 00:04:34,950 --> 00:04:36,360 So I'll see you in the next video. 6812

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