forked from Mrinank-Bhowmick/python-beginner-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
73 lines (64 loc) · 1.5 KB
/
main.py
File metadata and controls
73 lines (64 loc) · 1.5 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
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
68
69
70
71
72
73
# import random
# define a function to roll the dice
# create a dictionary that will have the drawings of the dice
import random
dice_drawing = {
1: (
" __________",
"| |",
"| 1 |",
"| ● |",
"| |",
"|__________|",
),
2: (
" __________",
"| |",
"| ● |",
"| 2 |",
"| ● |",
"|__________|",
),
3: (
" __________",
"| |",
"| 3 ● |",
"| ● |",
"| ● |",
"|__________|",
),
4: (
" __________",
"| |",
"| ● ● |",
"| 4 |",
"| ● ● |",
"|__________|",
),
5: (
" __________",
"| |",
"| ● 5 ● |",
"| ● |",
"| ● ● |",
"|__________|",
),
6: (
" __________",
"| |",
"| ● ● |",
"| ● 6 ● |",
"| ● ● |",
"|__________|",
),
}
def roll_dice():
roll = input("Roll the dice? (y/n) : ")
while roll.lower() == "y".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("\nRoll again? (y/n): ")
roll_dice()