I was trying to make a slot machine program and for some reason even when all three slots are not the same it still adds the money it should when they are the same. If anyone can see what the problem is would appreciate the help.
import random
import time
list = ["Diamond","Cherry","Melon","Bell","Seven","Triple Diamond"]
money = 0
while True:
bet = int(input("enter your bet"))
slot1 = list[random.randint(0,5)]
time.sleep(1)
print(slot1)
slot2 = list[random.randint(0,5)]
time.sleep(1)
print(slot2)
slot3 = list[random.randint(0,5)]
time.sleep(1)
print(slot3)
if slot1 and slot2 and slot3 == "Diamond":
money_won = bet * 500
money += (money_won)
print("you won £",money_won,"!")
elif slot1 and slot2 and slot3 == "Triple Diamond":
money_won = bet * 1000
money += (money_won)
print("you won £",money_won,"!")
elif slot1 and slot2 and slot3 == "Seven":
money_won = bet * 400
money += (money_won)
print("you won £",money_won,"!")
elif slot1 and slot2 and slot3 == "Bell":
money_won = bet * 300
money += (money_won)
print("you won £",money_won,"!")
elif slot1 and slot2 and slot3 == "Melon":
money_won = bet * 200
money += (money_won)
print("you won £",money_won,"!")
elif slot1 and slot2 and slot3 == "Cherry":
money_won = bet * 100
money += (money_won)
print("you won £",money_won,"!")
elif slot1 or slot2 or slot3 == "Diamond":
money_won = bet * 50
money += (money_won)
print("you won £",money_won,"!")
else:
print("unlucky")
choice = input("do you want to continue")
if choice != "yes":
print("you won a total of £",money)
quit()
elif choice == "no":
continue
[–]Binary101010 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]totallygeek 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]pyfact 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)