-
Notifications
You must be signed in to change notification settings - Fork 0
/
dice rolling simulator.py
60 lines (55 loc) · 1.19 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
import random
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()