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]
3 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]3 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
________ is/are used to temporarily hold small units of program instructions and data immediately before, during, and after exec
valentinak56 [21]
The registers are used to temporarily hold small units of data and instructions .<span />
5 0
3 years ago
True or false questions. If a statement is false, you must explain the reason why it is false: a). Suppose that TCP is being run
Dima020 [189]

Answer:

a. True

b. False

Explanation:

b. False

At the initial stage, the certificate needs to be encrypted not by the public key of certifier.com but by the by the private key of certifier.com.

After which, the certificate which contains lots information, (i.e there's more information in the certificate than just the public key to be certified). The certificate also the CA’s information, the certificate expiration date, etc.

Only this information’s digital fingerprint is encrypted by the certifier.com’s private key.

8 0
3 years ago
Read 2 more answers
A ____ is a copy that is kept in case values need to be restored to their original state.
Zepler [3.9K]
A backup is the copy made in this case
5 0
4 years ago
You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
valkas [14]
Client server network as it has a powerful server which provides all the networks required on the network. Files are usually backed up regularly.

3 0
4 years ago
A security system uses sensors at every door and window which will set off an alarm if any one of them is opened. There is also
AnnyKZ [126]
You have a raspberry pi connected to all the sensors and a code running to  trigger if the sensors are triggered. Each sensor and keypad would run to a different input on the pi. They should al be able to be powered with a single cell lipo. Is that what you are asking?
5 0
3 years ago
Other questions:
  • Who are some of my emails not all deleting on my android i have to use my laptop to see them to delete them?
    12·2 answers
  • A species of snake lives in a rainforest. Which would be an adaptation for this
    10·2 answers
  • How do i set up a RAID 1 array?​
    6·1 answer
  • Given the following code fragment, how many times does the loop body execute? int laps = 50; int myNum = 1; do { myNum = myNum +
    9·1 answer
  • Explain how class (static) variables and methods differ from their instance counterparts. Give an example of a class that contai
    7·1 answer
  • What does the doppler effect do?
    9·1 answer
  • What is the most likely reason that a digital artist would use a program such as Autodesk Maya or Max to create 3-D images for a
    12·1 answer
  • What is the definition of trouble shooting.
    12·1 answer
  • How many different textile items would you find at a festival? (please list 5 items)
    7·1 answer
  • You are building a game that needs to do the following:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!