# Untitled

Jun 23rd, 2021
660
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import random
2.
3. count = 0
4. running = True
5. rollTotal =0
6.
7. def dice(dieValue): #defines the ascii art of the die
8.     if (dieValue == 1):
9.         print('_______')
10.         print('|           |')
11.         print('|     o     |')
12.         print('|           |')
13.         print('_______')
14.
15.     if (dieValue == 2):
16.         print('_______')
17.         print('| o         |')
18.         print('|           |')
19.         print('|         o |')
20.         print('_______')
21.
22.     if (dieValue == 3):
23.         print('_______')
24.         print('|  o        |')
25.         print('|    o      |')
26.         print('|       o   |')
27.         print('_______')
28.
29.     if (dieValue == 4):
30.         print('_______')
31.         print('| o     o   |')
32.         print('|           |')
33.         print('| o      o  |')
34.         print('_______')
35.
36.     if (dieValue == 5):
37.         print('_______')
38.         print('| o        o  |')
39.         print('|      o      |')
40.         print('| o        o  |')
41.         print('_______')
42.
43.     if (dieValue == 6):
44.         print('_______')
45.         print('| o   o   o |')
46.         print('| o   o   o |')
47.         print('| o   o   o |')
48.         print('_______')
49.
50. def roll(a): #takes an argument for number of die, rolls them, and prints the total
51.     rollTotal =0
52.     count = 0
53.     while (count < a):
54.         dice(random.randint(1, 6))
55.         count = count+1
56.         rollTotal = rollTotal+1
57.     print('Total: '+ str(rollTotal))
58.
59. while(running == True):#main driver. prompts number of dice and passes that to the roll method
60.     print('How many die would you like to use?')
61.     numberOfDice = int(input())
62.     roll(numberOfDice)
RAW Paste Data