Westonci.ca connects you with experts who provide insightful answers to your questions. Join us today and start learning! Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
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.
Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Find reliable answers at Westonci.ca. Visit us again for the latest updates and expert advice.