-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDice_Simulator.py
More file actions
29 lines (24 loc) · 1.02 KB
/
Dice_Simulator.py
File metadata and controls
29 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import random #imports random module
def roll_dice():
inp = input("Do you want 1 die or 2 dice ? :")
if(inp == 1):
r1 = random.randint(1,6)
print "Rolling the dices....."
print "The values are........"
print("The top face of the die shows %s" % r1)
else:
r1 = random.randint(1,6)
r2 = random.randint(1,6)
add = r1 + r2
print "Rolling the dices....."
print "The values are........"
print ("The top face of the first die shows %s" %r1)
print ("The top face of the second die shows %s" %r2)
if __name__ == '__main__':
start = raw_input("Do you want to roll dices? : ")
if(start == 'yes' or start == 'YES'):
roll_dice()
roll_again = raw_input("Do you want to roll the dices again ? : ")
while roll_again == 'YES' or roll_again == 'yes' or roll_again == 'y' or roll_again == 'Y':
roll_dice()
roll_again = raw_input("Do you want to roll the dices again ? : ")