Python for Absolute Beginners Transcripts
Chapter: Code that interacts with users
Lecture: Our first interactive program

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Do you remember that jar of M&Ms at the restaurant? Where we said there's going to be a contest if you guess the exact number of M&Ms in here
0:09 and you win a free lunch. And we had this algorithm. Remember there was the person behind the bar behind the register
0:15 there was the woman who walked in to order. And the guy said Hey, how many M&Ms are in here? You get five tries, if you get it right, lunch is free.
0:22 Free, all right, up around 100. 50, too low 75, too high, 62. Boom, lunch is on the house. There's a lot of decisions here, right?
0:32 When she said 50, the program had to decide is that too low? Is that too high? Or is that the right answer? She said 75, same thing.
0:40 So we're going to recreate this little example but we're going to do it in code. And that guy on the left, here he's going to be the program.
0:48 The person on the right she is going to be the user interacting with our program. It's a pretty simple program to let us explore
0:55 some of these ideas of writing conditional code that makes decisions based on the data that is provided. And whether that comes from a user
1:02 from a file system, from a clock, from the internet. Who knows? It doesn't matter where it comes from it's all the same principle
1:09 and that's what we're going to build next.


Talk Python's Mastodon Michael Kennedy's Mastodon