File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import random
2+
3+
4+ dice_art = {
5+ 1 : ("┌─────────┐" ,
6+ "│ │" ,
7+ "│ ● │" ,
8+ "│ │" ,
9+ "└─────────┘" ),
10+ 2 : ("┌─────────┐" ,
11+ "│ ● │" ,
12+ "│ │" ,
13+ "│ ● │" ,
14+ "└─────────┘" ),
15+ 3 : ("┌─────────┐" ,
16+ "│ ● │" ,
17+ "│ ● │" ,
18+ "│ ● │" ,
19+ "└─────────┘" ),
20+ 4 : ("┌─────────┐" ,
21+ "│ ● ● │" ,
22+ "│ │" ,
23+ "│ ● ● │" ,
24+ "└─────────┘" ),
25+ 5 : ("┌─────────┐" ,
26+ "│ ● ● │" ,
27+ "│ ● │" ,
28+ "│ ● ● │" ,
29+ "└─────────┘" ),
30+ 6 : ("┌─────────┐" ,
31+ "│ ● ● │" ,
32+ "│ ● ● │" ,
33+ "│ ● ● │" ,
34+ "└─────────┘" )
35+ }
36+
37+ dice = []
38+ total = 0
39+ num_of_dice = int (input ("How many dice?: " ))
40+
41+ for die in range (num_of_dice ):
42+ dice .append (random .randint (1 , 6 ))
43+
44+ # PRINT VERTICALLY
45+ # for die in range(num_of_dice):
46+ # for line in dice_art.get(dice[die]):
47+ # print(line)
48+
49+ # PRINT HORIZONTALLY
50+ for line in range (5 ):
51+ for die in dice :
52+ print (dice_art .get (die )[line ], end = "" )
53+ print ()
54+
55+ for die in dice :
56+ total += die
57+ print (f"total: { total } " )
You can’t perform that action at this time.
0 commit comments