Skip to content

Commit 7d7fc3e

Browse files
Update 05 Pick6
1 parent 605d267 commit 7d7fc3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

1 Python/labs/05 Pick6

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Have the computer play pick6 many times and determine net balance.
44

55
Initially the program will pick 6 random numbers as the 'winner'. Then try playing pick6 100,000 times, with the ticket cost and payoff below.
66

7-
A ticket contains 6 numbers, 1 to 99, and the number of matches between the ticket and the winning numbers determines the payoff. Order matters, if the winning numbers are [5, 10] and your ticket numbers are [10, 5] you have 0 matches. If the winning numbers are [5, 10, 2] and your ticket numbers are [10, 5, 2], you have 1 match. Calculate your net winnings (the sum of all expenses and earnings).
7+
A ticket contains 6 numbers, 1 to 99, and the number of matches between the ticket and the winning numbers determines the payoff.
8+
Order matters, if the winning numbers are [5, 10] and your ticket numbers are [10, 5] you have 0 matches.
9+
If the winning numbers are [5, 10, 2] and your ticket numbers are [10, 5, 2], you have 1 match. Calculate your net winnings (the sum of all expenses and earnings).
810

911
a ticket costs $2
1012
if 1 number matches, you win $4
@@ -14,7 +16,8 @@ A ticket contains 6 numbers, 1 to 99, and the number of matches between the tick
1416
if 5 numbers match, you win $1,000,000
1517
if 6 numbers match, you win $25,000,000
1618

17-
One function you might write is pick6() which will generate a list of 6 random numbers, which can then be used for both the winning numbers and tickets. Another function could be num_matches(winning, ticket) which returns the number of matches between the winning numbers and the ticket.
19+
One function you might write is pick6() which will generate a list of 6 random numbers, which can then be used for both the winning numbers and tickets.
20+
Another function could be num_matches(winning, ticket) which returns the number of matches between the winning numbers and the ticket.
1821
Steps
1922

2023
Generate a list of 6 random numbers representing the winning tickets

0 commit comments

Comments
 (0)