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?
0:02 Where we said there's going to be a contest
0:05 if you guess the exact number of M&Ms in here
0:08 and you win a free lunch.
0:10 And we had this algorithm.
0:11 Remember there was the person behind the bar
0:13 behind the register
0:14 there was the woman who walked in to order.
0:16 And the guy said
0:17 Hey, how many M&Ms are in here?
0:19 You get five tries, if you get it right, lunch is free.
0:21 Free, all right, up around 100.
0:23 50, too low
0:25 75, too high, 62.
0:27 Boom, lunch is on the house.
0:29 There's a lot of decisions here, right?
0:31 When she said 50, the program had to decide
0:34 is that too low?
0:35 Is that too high?
0:36 Or is that the right answer?
0:37 She said 75, same thing.
0:39 So we're going to recreate this little example
0:42 but we're going to do it in code.
0:44 And that guy on the left, here
0:46 he's going to be the program.
0:47 The person on the right
0:49 she is going to be the user interacting with our program.
0:52 It's a pretty simple program to let us explore
0:54 some of these ideas of writing conditional code
0:56 that makes decisions based on the data that is provided.
1:00 And whether that comes from a user
1:01 from a file system, from a clock, from the internet.
1:05 Who knows?
1:06 It doesn't matter where it comes from
1:07 it's all the same principle
1:08 and that's what we're going to build next.