-- Dice Rolling Simulator using Python-random
Source Code
import random
a = input("Press Y To Roll The Dice :")
print("\n")
def random_number():
n = random.randint(1,6)
if n == 1:
print("-------")
print(" ")
print(" 0 ")
print(" ")
print(" ")
print("-------")
elif n == 2:
print("-------")
print(" 0 ")
print(" ")
print(" ")
print(" 0 ")
print("-------")
elif n == 3:
print("-------")
print(" 0 ")
print(" 0 ")
print(" 0 ")
print("-------")
elif n == 4:
print("-------")
print("0 ")
print(" 0 ")
print(" 0 ")
print(" 0")
print("-------")
elif n == 5:
print("-------")
print("0 0")
print(" ")
print(" 0 ")
print(" ")
print("0 0")
print("-------")
elif n == 5:
print("-------")
print("0 0")
print(" ")
print("0 0")
print(" ")
print("0 0")
print("-------")
while True:
random_number()
Comments
Post a Comment