PY
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
#after having left for a VERY long time, I've advanced quite a bit. This program doesn't work in sololearn. So I suggest just copy-pasting it into a proper python software
import random
def input_dice():
while True:
dice_input = input("How many dice do you want to roll? ")
try:
dice = int(dice_input)
if dice > 0:
return dice
else:
print("Please enter a positive integer.")
except ValueError:
print("Please enter a number.")
def input_roll_amount():
while True:
amount = input("How many times do you want to roll? ")
if amount.lower() == "change dice" or amount.lower() == "cd":
roll()
elif amount.lower() == "break":
exit()
try:
amount = int(amount)
if amount > 0:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run