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 of programming that we focused on was conditional statements.
0:06 Remember we were talking about how to make code, decide and make it interactive? So, here we're getting a random number from the computer.
0:13 Remember that was the number of M&Ms in the jar and then we're getting a guess from the user on whether or not, you know, whatever number of M&Ms
0:20 they thought there were there. And then we can check. If the guess is too low, we can say Your guess is too low.
0:26 If it's too high, we say, it's too high and if they win, then they win. And this let us go around and around until they got the number of guesses right
0:33 or they ran out of attempts. Remember they got five attempts to get it right they got a free lunch, or they just didn't get anything
0:40 and had to pay for lunch. So, these conditional statements either are if elif, there's all these combinations you can have
0:46 but they always start with if and they have some kind of truthy test like guess less the number or if you have a string
0:52 you just put the string there and say if there is a value for the string we're going to do this thing and so on. So, if, elif, else
0:59 and you put the -uthy type of statements in there to check them.


Talk Python's Mastodon Michael Kennedy's Mastodon