0:00
Hello.
00:01
For problem 15, you're asked to revise listing for 10, which is generating lottery numbers to instead generate a three -digit lottery number and then prompt the user to enter a three -digit number and determine whether or not the user wins.
00:20
And it gives some rules as to how to determine whether or not the user wins.
00:26
So first we need to generate our lottery number.
00:30
We'll do that by using random .randint, and because we want a three -digit number, we want to generate a number between zero and nine hundred and 99.
00:41
Then our guess is going to be the result of having a user input where we're prompting with enter your lottery pick three digits.
00:53
Then we need to get the digits from, the lottery number.
00:59
So lottery digit one will just be the lottery number divided with these two lines by 100.
01:08
Lottery digit two is going to be lottery with the two lines 10, modulo 10, and then lottery digit three is just lottery module 10.
01:18
And we want to do the same and get the digits from the guess.
01:22
And i'll point out that you want to make sure that this is working properly do so you can print out the digits so that you can make sure that digits one, two, and three are indeed correct for the three digit number that you choose or that is generated.
01:43
And i found that this worked to get the correct digits.
01:47
Next, we want to print the lottery number is, whatever the lottery number is.
01:52
And then we need to check the guess.
01:54
If they are exactly equal to each other, it's an exact match.
01:58
And based on the rules of the game, you win $10 ,000.
02:03
Next, we want to check if all the digits match the digits in the lottery number, because then you'll still win a prize.
02:14
So here i've come up with conditions where we say digit two is equal to, guess digit two is equal to lottery digit one, guest digit three is equal to lottery digit two, and guess digit 1 is equal to lottery digit 3.
02:29
So that's one condition.
02:31
And we can say that or mixing it up...