Aug-06-2017, 11:15 PM
So, I wanted to play D&D with my friends and I had an idea. What if I code a program to roll the dice for me?
Here is my first try, I don't know anything about coding, so it kind of sucks.
Any advice is welcome.
Thank you all :3
Here is my first try, I don't know anything about coding, so it kind of sucks.
Any advice is welcome.
Thank you all :3
import random def Random(): while True: try: dice = int(input("How many dice? ")) break except: print("That's not a valid option!") while True: try: side = int(input("How many sides? ")) break except: print("That's not a valid option!") x = 0 total = 0 while x < dice: x = x+1 rolls = random.randint (1, side) total = total+rolls print rolls print "Total =", total Random() Random()