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
Write a program that prompts the user for a measurement inmeters and then converts it into miles, feet, and inches.
zubka84 [21]

Answer:

Program for measurement in meters and then converts it into miles, feet, and inches:

#include<iostream.h>

#include<conio.h>

void main()

{  float meter, mile, feet, inches;

 cout<<"enter meters";

 cin>>meters";

 feet=meter×3.2808;

 mile= meter×0.000621371;

 inches= meter×39.3701;

cout<<"Value of"<<meter<<"meter"<<"in feet is"<<feet<<"feet":

cout<<"Value of"<<meter<<"meter"<<"in mile is"<<mile<<"mile";

cout<<"Value of"<<meter<<"meter"<<"in inches is"<<inches<<"inches";

getch();

}

8 0
3 years ago
List the types of infrared we have
Vlad [161]

Answer: infared types like the sun, sun light, heat lamps, and radiators

6 0
3 years ago
Each row in a database is a set of unique information called a(n) (A.)table,(B.)record,(C.)object,(D.)field
sashaice [31]

Answer:

-------------------------######################

4 0
3 years ago
Read 2 more answers
Which process improves the life of a computer?
arlik [135]

maintenance is the answer

3 0
3 years ago
Files and folders in UNIX can be removed using the
wel

<em>Files and folders in UNIX can be removed using the</em>  <u><em>rm command.</em></u>

<em>The answer is B. rm command </em>

<em>Hope this helps :)</em>

3 0
3 years ago
Other questions:
  • Create a class named Person that holds the following fields: two String objects for the person’s first and last name and a Local
    5·2 answers
  • assume that you want to sort an array have 100000 elements which algorithm (insert sort algorithm or quick sort algorithm) is th
    12·1 answer
  • A sense of scale tells us what about the objects in a picture?
    11·2 answers
  • What is blogging
    15·2 answers
  • 2) Search the Web for two or more sites that discuss the ongoing responsibilities of the security manager. What other components
    15·1 answer
  • What is your favourite video game??​
    5·2 answers
  • Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
    5·1 answer
  • Use a spreadsheet to solve this business problem. The owners of an electronics store want to find which of their products makes
    6·1 answer
  • Web résumés allow you to include extra graphics and images that you would not include in a traditional résumé. Please select the
    12·1 answer
  • The Western Siberian Plain is __________ in some places because it has poor natural draining systems.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!