1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elixir [45]
2 years ago
5

Write a lottery program that will ask the user if they would like to pick 5 numbers (1-30) or if they would like to choose EZ Pi

ck where the computer randomly picks their 5 numbers at a cost of $1.00. Then you will give them a chance to also play the Next Chance drawing for an extra $1.00. They do not choose additional numbers for the Next Chance drawing. Once they have all of their selections complete, have the computer game generate the five random winning numbers and if they opted for the Next Chance drawing, select 4 more random numbers. Display all of the users numbers, all of the winning numbers, and display how much, if any, that the player has won based on the following information:
Computers and Technology
1 answer:
Llana [10]2 years ago
6 0

Answer:

Explanation:

The following code is written in Python and creates arrays for the user's numbers and the next chance numbers, it also creates a cost variable and a did_you_win variable. The function takes in the winning numbers as an array parameter. It asks all the necessary questions to generate data for all the variables and then compares the user's numbers to the winning numbers in order to detect if the user has won. Finally, it prints all the necessary information.

import random

def lottery(winning_numbers):

   user_numbers = []

   next_chance_drawing = []

   cost = 0

   did_you_win = "No"

   #print("Would you like to choose your own 5 numbers? Y or N")

   answer = input("Would you like to choose your own 5 numbers? Y or N: ")

   if answer.capitalize() == "Y":

       for x in range(5):

           user_numbers.append(input("Enter number " + str(x+1) + ": "))

   else:

       for x in range(5):

           user_numbers.append(random.randint(0,31))

           cost += 1

   next_chance = input("Would you like to enter a Next Chance drawing for $1.00? Y or N: ")

   if next_chance.capitalize() == "Y":

       for x in range(4):

           next_chance_drawing.append(random.randint(0, 31))

           cost += 1

           

   if user_numbers == winning_numbers or next_chance_drawing == winning_numbers:

       did_you_win = "Yes"

   print("User Numbers: " + str(user_numbers))

   print("Next Chance Numbers: " + str(next_chance_drawing))

   print("Cost: $" + str(cost))

   print("Did you win: " + did_you_win)

You might be interested in
If a company's IS-related programs are not developed in-house, then the development group of the IS department will be staffed p
EastWind [94]

Answer:Systems analysts

Explanation: System analyst is referred as the person in an organization for resolving the issue related program and information technologies. The person basically design the solution by analyzing the problem accordingly.

Information system of company has any separate department for handling the problems related with the IS-related programs. These problem usually lies under the department of the system analyst. They work on the problem solving, improvement and improvisation, training etc.

3 0
3 years ago
What: A challenging question on this module's material.
Alekssandra [29.7K]

Need further information!!!

6 0
3 years ago
PLEASE HURRY
creativ13 [48]
I'm pretty sure it's C) or D) because it seems those make the most sense because providing excitement does not matter if that is not their point, repeating a previous point is practically useless because that point has already been said.
5 0
3 years ago
Read 2 more answers
What are strategies that you can use to yield web sites that are relevant to your research topic?
evablogger [386]

Answer: PLEASE MARK BRAINELEIST

Locating Useful Resources

When you chose a paper topic and determined your research questions, you conducted preliminary research to stimulate your thinking. Your research proposal included some general ideas for how to go about your research—for instance, interviewing an expert in the field or analyzing the content of popular magazines. You may even have identified a few potential sources. Now it is time to conduct a more focused, systematic search for informative primary and secondary sources.

5 0
3 years ago
1. What are the advantages and disadvantages of the digital darkroom as compared to a regular
ki77a [65]

Answer:

The advantages of a digital darkroom is that it allows the photographer to make minor changes to improve a photograph. The disadvantage is that the more you want your picture to come out better you would need to waste your time or be patient to get the picture and buy a better camera.

4 0
3 years ago
Other questions:
  • What is the purpose of a title slide on power point
    14·2 answers
  • So when i try to click on an assignment to answer it the ask a question thing pops up and i can't exit out of it. I've tried rel
    10·2 answers
  • A variation of pronounce is a. Proclaim c. Produce b. Profound d. Pronunciation Please select the best answer from the choices p
    11·1 answer
  • (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts)Ex:Davy's auto shop servicesOil chan
    9·1 answer
  • 2.8 Code Practice: Question 2
    11·1 answer
  • How can i clear the CMOS​
    6·1 answer
  • Write a program that takes the account's present value, monthly interest rate, and the number of months that the money will be l
    5·1 answer
  • Which staff member takes a set of plans and supervises their construction?
    6·1 answer
  • Helppppppppppp please
    5·2 answers
  • If you wanted to divide an integer variable by 2, which of the following lines of code would you use? total = int + 2 total = in
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!