-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dice Rolling Simulator.py
68 lines (59 loc) · 1.31 KB
/
Dice Rolling Simulator.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# import random
# define a function to roll the dice
# create a dictionary that will have drawing of the dice
import random
import string
def roll_dice():
dice_drawing = {
1: (
"-----",
"| |",
"| o |",
"| |",
"-----",
),
2: (
"-----",
"|o |",
"| |",
"| o|",
"-----",
),
3: (
"-----",
"|o |",
"| o |",
"| o|",
"-----",
),
4: (
"-----",
"|o o|",
"| |",
"|o o|",
"-----",
),
5: (
"-----",
"|o o|",
"| o |",
"|o o|",
"-----",
),
6: (
"-----",
"|o o|",
"|o o|",
"|o o|",
"-----",
),
}
roll = input("Roll the dice? (Yes/No) : ")
while roll.lower() == "Yes".lower():
dice1 = random.randint(1, 6)
dice2 = random.randint(1, 6)
print("dice rolled: {} and {}".format(dice1, dice2))
print("\n".join(dice_drawing[dice1]))
print("\n".join(dice_drawing[dice2]))
roll = input("Roll again? (Yes/no): ")
roll_dice()