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
Stolb23 [73]
3 years ago
10

Suppose you want to develop a program to play lottery. The program randomly generates a Lottery of a two-digit number, prompts t

he user to enter a two-digit number, and determines whether the user wins according to the following rule: 1. If the user matches the lottery in exact order , the awards is $10,000. 2. If the user input matches the lottery, the awards is $3,000. 3. If one digit in the user input matches a digit in the lottery, the awards is $1,000.

Computers and Technology
1 answer:
Brilliant_brown [7]3 years ago
6 0

Python Code with Explanation:

import random  

# get a two digit number from the user

guess=int(input("Please enter a two digit number: "))

# here we are generating a two digit random number from 10 to 99

lottery=random.randrange(10, 99)

# print the Lottery digits

print("Lottery digits are: ",lottery)

# we separated the two digits, dividing by 10 returns the 1st digit and modulus of 10 returns the 2nd digit

lottery_1st = lottery // 10

lottery_2nd = lottery % 10

guess_1st = guess // 10

guess_2nd = guess % 10

# now we compare all the cases given in the question using if elif commands

if lottery == guess:

   print("All digits match in exact order! You won $10,000")

elif lottery_1st == guess_2nd and lottery_2nd == guess_1st:

   print("All digits match but not in exact order! You won $3,000!")

elif lottery_1st == guess_1st or lottery_2nd == guess_2nd or lottery_2nd == guess_1st or lottery_1st == guess_2nd:

   print("Only one digit matches! You won $1,000!")

else:

   print("None of the digits match! Better Luck next time!")

Output:

Test 1:

Please enter a two digit number: 84

Lottery digits are: 48

All digits match but not in exact order! You won $3,000

Test 2:

Please enter a two digit number: 71

Lottery digits are: 28

None of the digits match! Better Luck next time!

Test 3:

Please enter a two digit number: 45

Lottery digits are: 45

All digits match in exact order! You won $10,000

Test 4:

Please enter a two digit number: 40

Lottery digits are: 14

Only one digit matches! You won $1,000

You might be interested in
___________ is an approach to boundary spanning that results from using sophisticated software to search through large amounts o
snow_tiger [21]

Answer: Business intelligence

Explanation:

Most of the enterprises and organizations collects huge amount of data through the use of MIS. These data can be based on any aspect of the business. But the collection of such large sets of data is useless until and unless there is a business intelligence associated with it. the work of business intelligence is to use software tools for analysis of the collected data so that it could be useful for enterprise or company to look for patterns and trends in the market.

The outcome of such business intelligence is very helpful particularly to managers, executives for taking particular decisions in the greater interest of the company.

So we can say, business intelligence is an approach to boundary spanning that results from using sophisticated software to search through large amounts of internal and external data to spot patterns, trends, and relationships that might be significant.

4 0
3 years ago
Which of the following BEST represents the relationship between physical fitness and exercise?
adoni [48]
Exercise is a subset of physical fittness
8 0
3 years ago
Select the correct answer. Adrian sent his manager Stacy an email message that required her immediate attention. Stacy was unabl
zaharov [31]
B. Lack of security
7 0
3 years ago
Read 2 more answers
Write an overloaded constructor for the Table class that will take a single argument for the color of the table Write a set meth
creativ13 [48]

Explanation:

Below is required code in java :-

public class Table{

   private String color;    //attribute to store the color of the table

   public Table(){    //default constructor

       this.color="";   //set a default blank color

   }

   public Table(String color){    //overloaded constructor

       this.color=color;    //set the color value equal to the parameter provided

   }

   public void setColor(String color){    //setter or mutator method

       this.color=color;    //set the color value equal to the parameter provided

   }

}

8 0
4 years ago
Janice is making her resume in which section should she include information about her previous employers , positions held , and
Volgvan

Generally, Janice should post information about her past employment in the Experience section, also often called as Professional Experience. The information that she should include is the name of the organization or company which previously employed her, her positions there, length of each position, and a description of what she did in the position.

4 0
3 years ago
Other questions:
  • By apply styles, _____________ formats are being applied each time.
    6·1 answer
  • What is the best overall approach to education and career development for IT professionals?
    14·1 answer
  • Which of the following is true of how the Internet has responded to the increasing number of devices now using the network? a) T
    12·2 answers
  • What is the purpose of using modulo 2 arithmetic rather than binary arithmetic in computing an fcs?
    7·1 answer
  • Assignment 3: Chatbot
    11·2 answers
  • Memory management is concerned with __________.
    14·1 answer
  • COMPUTER FUNDIMENTAL HELP 20 POINTS!!!
    5·1 answer
  • A store that has both an e-commerce site as well as a physical store (building) is known as:
    8·1 answer
  • A salesman has been traveling to different businesses all day to give a sales presentation. Each time, he was starts up his lapt
    12·1 answer
  • Your connection to this site is not secure how to fix.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!