SHARE
TWEET

Untitled

a guest Oct 16th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random, os
  2. '''
  3. run using python3 dice.py in terminal
  4. made by Jaden Arceneaux
  5. '''
  6. dice = []
  7. total = 0
  8.  
  9. def addDie():
  10.     global total
  11.     print('how many sides does your die have')
  12.     dieSides = int(input())
  13.     dice.append(dieSides)
  14.  
  15. def roll():
  16.     global total, dice
  17.     for die in dice:
  18.         rolled = random.randint(0, die)
  19.         print('die numeber ' + str(dice.index(die) + 1) + ' rolled: ' + str(rolled))
  20.         total += rolled
  21.     print('total: ' + str(total))
  22.     total = 0
  23.     dice = []
  24.  
  25. while True:
  26.     for die in dice:
  27.         print(str(die) + ' sided die')
  28.     print('\nadd die\nroll\nquit')
  29.     userIn = input().lower()
  30.     if 'add die' in userIn:
  31.         addDie()
  32.         os.system('clear')
  33.         continue
  34.     elif 'roll' in userIn:
  35.         roll()
  36.         continue
  37.     elif 'quit' in userIn:
  38.         os.system('clear')
  39.         break
  40.     else:
  41.         print('not in system')
  42.         continue
  43.  
  44. print('bye \n    -Jaden')
  45.  
  46. # ps I did it ismael
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top