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
How could you insert a new row between rows 20 and 21?
love history [14]
<span>The Answer is C. Right-click row 21's row number, and then click Insert.

</span>
6 0
2 years ago
Read 2 more answers
With landscape photography, which depth of field do you normally want? A) Small B)Small to Medium C)Large D)With landscapes it d
RideAnS [48]
I am not 100% on this but i think you would want a Large depth of field. 
3 0
3 years ago
Read 2 more answers
What are the side effects of overclocking?
Oksana_A [137]

Answer:

Reduced processor lifespan, reduced fan cooler performance over time, bugs.

Explanation:

The reason is that when you overclock your processor you are increasing its base speeds in GHZ. The processor was designed to work at a determined speed, let's say 3.00 ghz. If you increase this speed to 4.00 ghz, it's not just that now it's working faster, it also draws more power from your power supply, and increases the heat that the chip is taking. Processors are designed to endure high temperatures, therefore, you will likely not see any damaged in short term, but your components life span will be severely reduced, also depending on how much you overclock the processor, and the stability of your system, you can see bugs, unexpected restarts, and strange behavior of the computer. As an example, the i5 4670k runs at 3.80 stock speed, it can reach 50 / 65 degrees under full load. If you raise the speed up to 4.5ghz it will reach 70/80 degrees, depending on your ambient temperature and other factors.

6 0
2 years ago
Is a "Stock Transfer Clerk" in charge of putting the objects on the shelfs?
ella [17]
They are in charge of keeping records, documenting information of ownership and processing requests.
5 0
3 years ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
postnew [5]

Answer: 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Explanation: x1

8 0
2 years ago
Other questions:
  • Which function of a web page relies on responsive web design? Adding extra horizontal scroll Blocking mobile devices from viewin
    11·2 answers
  • Select the correct statement(s) regarding digital baseband modulation.
    7·1 answer
  • Who was one of the founders of the location sharing site Foursquare​
    10·1 answer
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • What is the Documenter?
    10·1 answer
  • Andy, a developer, is designing a new program. Which tool should Andy use to help him complete his task?
    13·1 answer
  • You are in the middle of a big project at work. all of your work files are on a server at the office. you want to be able to acc
    14·1 answer
  • Linda wants to apply for a job in a company of her choice. Which information would her potential employers likely review in her
    10·2 answers
  • How can we style the images and layouts of our pages?
    8·1 answer
  • What software application is most appropriate to use to create multimedia presentations?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!