# Version 1: Simply 3 random numbers
import random
def run_Slotmachine():
result = [0, 0, 0]
for i in range(3):
result[i] = random.randint(1,6)
return result
result = run_Slotmachine()
if result[0]==result[1]==result[2]:
print("You have won: ", result)
else:
print("You have lost: ", result)
# Version 2: 3 random numbers generated by 100 Iterations
import random
def run_Slotmachine():
result = [0, 0, 0]
for i in range(3):
for j in range(100):
result[i] = random.randint(1,6)
return result
result = run_Slotmachine()
if result[0]==result[1]==result[2]:
print("You have won: ", result)
else:
print("You have lost: ", result)
# Version 3: 3 random numbers generated by random Iterations
import random
def run_Slotmachine():
result = [0, 0, 0]
for i in range(3):
for j in range(random.randint(1,100)):
result[i] = random.randint(1,6)
return result
result = run_Slotmachine()
if result[0]==result[1]==result[2]:
print("You have won: ", result)
else:
print("You have lost: ", result)
# Version 4: 3 random numbers generated by random Iterations
import random
def run_Slotmachine():
result = [0, 0, 0]
for i in range(3):
for j in range(random.randint(1,100)):
result[i] = random.randint(1,6)
return result
result = run_Slotmachine()
if result[0]==result[1]==result[2]:
print("You have won: ", result)
else:
print("You have lost: ", result)
import random
def run_Slotmachine():
result = [0, 0, 0]
for i in range(3):
for j in range(100):
result[i] = random.randint(1,6)
return result
result = run_Slotmachine()
if result[0]==result[1]==result[2]:
print("You have won: ", result)
else:
print("You have lost: ", result)