Python for Absolute Beginners Transcripts
Chapter: Code that interacts with users
Lecture: Concept: Conditional statements

Login or purchase this course to watch this video and the rest of the course contents.
0:00 That program we wrote, that was pretty involved. Yeah we only used a few core concepts but they were really important things that we covered
0:07 and we kind of built this little kind of game challenge type thing for our customers that was cool. When we want to have some kind of conditional logic
0:16 branching logic, do this or that based on some condition we used the if the, elif, and the else keywords. So in this case we're going to get a number
0:25 some random number and a guess from the user. You can imagine how that goes from the previous example we just did
0:31 and we're going to test, is the guess too low. If it is, we're going to print out a message hey the guess is too low.
0:36 If the guess is too high, we're going to say else, if, elif is the other test, is the guess too high then it's too high.
0:43 If it's not too low, it's not too high it must be Goldilocks, it's just right so they must be equal. We're going to say yes you got it.
0:50 There were however many numbers of M&Ms in the jar.

Talk Python's Mastodon Michael Kennedy's Mastodon