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: ")
Step-by-step 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.