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
allsm [11]
3 years ago
8

A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot mach

ine then displays a set of random images. If two or more of the images match, the user wins an amount of money that the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. Instead of displaying images, the program will randomly select a word from the following list: Cherries, Oranges, Plums, Bells, Melons, Bars The program will select and display a word from this list three times. If none of the randomly selected words match, the program will inform the user that he or she has won $0. If two of the words match, the program will inform the user he or she has won two times the amount entered. If three of the words match, the program will inform the user that he or she has won three times the amount entered. The program will ask whether the user wants to play again. If so, these steps are repeated. If not, the program displays the total amount of money entered into the slot machine and the total amount won.
Computers and Technology
1 answer:
postnew [5]3 years ago
4 0

Answer:

import random

is_cont = 'y'

amount = float(input("Enter amount: "))

total = 0.0

slot = ['Cherries', 'Oranges', 'Plums', 'Bells', 'Melons', 'Bars']

while is_cont == 'y':

   hold = []

   for i in range(3):

       ent = random.choice(slot)

       print(ent)

       hold.append(ent)

   if hold.count(hold[0]) == 3 or hold.count(hold[1]) == 3 or hold.count(hold[2]) == 3:

       print(f"{3 * amount}")

       total += 3 * amount

   elif hold.count(hold[0]) == 2 or hold.count(hold[1]) == 2 or hold.count(hold[2]) == 2:

       print(f"{2 * amount}")

       total += 2 * amount

   else:

       print("$ 0")

   is_cont = input("Try again? y/ n: ")

Explanation:

The python program is in a constant loop so long as the 'is_cont' variable has a value of 'y'. The program implements a slot machine as it gets an amount of money from the player and randomly selects an item from the slot list variable three times.

If all three selections match, the player gets three times the amount paid and if two items match, then the player gets twice the pay but gets nothing if all three items are different.

You might be interested in
What is a symptom of a failing power supply? The display has only a blinking cursor. The computer displays a POST error code. Th
Mariulka [41]

Answer:

A sympton of a failing power supply is The computer sometimes does not turn on.

Explanation:

All right, the power supply is the terminal that receives electric current to process it and distribute it to the different parts of the hardware that compose the computer. When it fails, the current is not distributed and doesn't reach the different pieces of hardware. Therefore, option D) is the correct one. Another error that could be related is the malfunction of fans but it could be related to wires more than the power itself.

7 0
4 years ago
What is output when the CarTest application is run? Why?
erik [133]

Answer:

red

Explanation:

public class CarTest {

public static void main(String[] argvs) {

//below line will create an object of CarTest class Object

CarTest carTest = new CarTest();

//This will call runDemo method

carTest.runDemo();

}

public void runDemo() {

//Below line will create an object of Car class  with color blue and 4 wheel

Car c = new Car("blue", 4);

//Bellow Line will change the color from blue to red, see the logic writteen in chnageColor method definition

changeColor(c, "red");

//Below line will print the color as red

System.out.println(c.getColor());

}

public void changeColor(Car car, String newColor) {

//This line will set the color as passed color in the car object

car.setColor(newColor);

}

}

5 0
4 years ago
Does the estimate of a tolerance level of 68.26% of all patient waiting times provide evidence that at least two-thirds of all p
ivanzaharov [21]

Answer:

Yes, because the upper limit is less Than 8 minutes

Explanation:

According to the empirical formula :

68.26% of data lies within 1 standard deviation from the mean;

Hence,

Mean ± 1(standard deviation)

The sample mean and sample standard deviation of the given data is :

Sample mean, xbar = Σx / n = 546 / 100 = 5.46

Sample standard deviation, s = 2.475 (Calculator)

The interval which lies within 68.26% (1 standard deviation is) ;

Lower = (5.460 - 2.475) = 2.985

Upper = (5.460 + 2.475) = 7.935

(2.985 ; 7.935)

Since the interval falls within ; (2.985 ; 7.935) whose upper level is less than 8 means patients will have to wait less Than 8 minutes.

8 0
3 years ago
Joaquin is considering a career as an animator and wants to know more about the daily work of an average animator. Which strateg
Advocard [28]
Lacking a response to my question, I'll assume there's no "correct' answer here. 

Joaquin could contact the university's graphic arts department, or if he's interested in the programming side of it, the computer science department, and ask if they have any information on the topic. If he's already majoring to become an animator, then he should talk to one of his professors to see if they know someone in the business that would speak with Joaquin. 

The faster and better way would be to go to reddit, or some site at which animators congregate (most probably found through Google), read the forums, and create if he's not finding a suitable answer.
3 0
4 years ago
What year did polaroid introduce one-step photography with the SX-70
blagie [28]

Answer:

I first saw the Polaroid SX-70—the one-step instant camera introduced in 1972 by the company's co-founder, Dr.

Explanation:

5 0
3 years ago
Other questions:
  • The World Wide Web (WWW) is a network of links on the Internet to documents containing text, graphics, video, and sound, but doe
    10·1 answer
  • You are part of a team that is setting up a movie streaming service. The company is planning on initially making available 500 m
    8·1 answer
  • A Raycast returns a float that tells you how far away an Object is
    8·1 answer
  • In the design phase of the systems development life cycle (SDLC), the _____ design is an overview of the system and does not inc
    10·1 answer
  • The term integration mean?
    7·2 answers
  • What is wrong with this code and correct it.
    12·1 answer
  • BRAINLEST AND 20 POINTS! Most GUls provide all of the following except
    6·2 answers
  • How many voltage values can be represented with a 10-bit binary code?
    15·1 answer
  • 15. Virus cannot infect files that are saved in i. USB ii. CD-ROMs iii. Memory card iv. All of them​
    14·2 answers
  • Which code block is an example of a motion block in scratch?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!