Python for Absolute Beginners Transcripts
Chapter: Course conclusion
Lecture: Review: Conditional statements

Login or purchase this course to watch this video and the rest of the course contents.
0:00 One of the first interesting parts
0:01 of programming that we focused on
0:03 was conditional statements.
0:05 Remember we were talking about how to make code, decide
0:08 and make it interactive?
0:10 So, here we're getting a random number from the computer.
0:12 Remember that was the number of M&Ms in the jar
0:15 and then we're getting a guess from the user
0:17 on whether or not, you know, whatever number of M&Ms
0:19 they thought there were there.
0:21 And then we can check.
0:22 If the guess is too low, we can say
0:24 Your guess is too low.
0:25 If it's too high, we say, it's too high
0:27 and if they win, then they win.
0:28 And this let us go around and around
0:30 until they got the number of guesses right
0:32 or they ran out of attempts.
0:34 Remember they got five attempts to get it right
0:36 they got a free lunch, or they just didn't get anything
0:39 and had to pay for lunch.
0:40 So, these conditional statements either are if
0:42 elif, there's all these combinations you can have
0:45 but they always start with if
0:46 and they have some kind of truthy test
0:48 like guess less the number
0:50 or if you have a string
0:51 you just put the string there and say
0:52 if there is a value for the string
0:54 we're going to do this thing and so on.
0:56 So, if, elif, else
0:58 and you put the -uthy type of statements in there
1:00 to check them.