00:02
Good day, ladies and gentlemen.
00:05
Today, we're looking at problem number 4 .4 from the great python book, and it is entitled learn edition.
00:16
And we're supposed to, again, test people's ability to do addition.
00:24
So what do we have to do? so first off, we're going to use random, randint between 0 and 100 to generate 2.
00:34
Integers, a and b.
00:38
Then we're going to prompt the user to guess what a plus b is.
00:44
And we're going to return true, of course, if the guess is correct and false otherwise.
00:53
So in particular, then, this final statement here is what they call a conditional statement.
01:00
So it's going to be conditioned on whether the guess is correct or not.
01:07
So conditional statements were discussed in the book, and that's what we're going to do.
01:14
So, okay, let's begin.
01:17
So when doing this, the first thing we have to do is import random, because we're going to be using random.
01:28
We're going to be getting two random integers.
01:34
So we'll say a is equal to random dot randint from zero to 100.
01:54
And we want to do the same thing here.
02:03
But now we'll get our two numbers, a and b.
02:07
So now what do we have to do? well, next we want to do a, we want to do a, we want to do, we want to ask the user for their input.
02:23
So we want input.
02:28
What is a plus b? so we're saying what is a plus b? but the way i'm doing it is i'm doing this format.
02:46
So what this will do is it will import the a value into the first spot and the v value into the second spot equal and have in there.
03:06
So i'm using the format a, b.
03:13
And doing this is actually a very nice, i'm doing it this way is very nice.
03:19
And actually it took me a while to discover this whole input, this evaluate input trick, which i actually find to be very nice, to be honest with you.
03:34
And now on the conditional statement, we want to do a print.
03:40
We want to say maybe something like this.
03:45
Your answer, maybe i'll do it like this, comma.
03:49
And again, now what this is going to do, it's going to put your guess into this here.
04:04
And then i'm going to go plus is space.
04:14
And now comma, you want to say a plus b equals to guess...