## We now have code that can simulate a single lottery. You need to expand this code into not one, not ten, but any number of simulations of the lottery.

### computer science

##### Description

­CSCI 161: You never know.

# Well, sometimes you do…the Lottery

### Objective:

This is a continuation of our in-class code simulating a lottery.

### Assignment:

We now have code that can simulate a single lottery. You need to expand this code into not one, not ten, but any number of simulations of the lottery. Imagine someone who buys a lottery ticket every week. In less than 20 years, this person will have purchased more than 1,000 lottery tickets. You need to simulate how much money this person would have won or lost over the years. As a refresher, here are the rules for the simple version of the Texas lottery:

Pick 6 numbers between 1-54:

-          If all 6 match, you win the jackpot. This can vary wildly between \$5,000,000 and \$36,000,000. We’ll just take an optimistic value of \$20,000,000.

-          If 5 of the 6 match, you get \$2,000.

-          If 4 of 6 match, you get \$50.

-          If 3 of 6 match, you get \$3.

-          Otherwise, you get nothing.

So you will ask the user how many rounds are to be simulated, and then print the numbers the user picked (can be fixed or random, doesn’t really matter), the numbers that actually came up, and keep a running total of the amount spent (easy: \$1 per round) and the amount won (see bullet list above). At the end of the simulation, print the total profit (unlikely) or loss after playing.

This assignment is also worth 30 points.