Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random, os
- '''
- run using python3 dice.py in terminal
- made by Jaden Arceneaux
- '''
- dice = []
- total = 0
- def addDie():
- global total
- print('how many sides does your die have')
- dieSides = int(input())
- dice.append(dieSides)
- def roll():
- global total, dice
- for die in dice:
- rolled = random.randint(0, die)
- print('die numeber ' + str(dice.index(die) + 1) + ' rolled: ' + str(rolled))
- total += rolled
- print('total: ' + str(total))
- total = 0
- dice = []
- while True:
- for die in dice:
- print(str(die) + ' sided die')
- print('\nadd die\nroll\nquit')
- userIn = input().lower()
- if 'add die' in userIn:
- addDie()
- os.system('clear')
- continue
- elif 'roll' in userIn:
- roll()
- continue
- elif 'quit' in userIn:
- os.system('clear')
- break
- else:
- print('not in system')
- continue
- print('bye \n -Jaden')
- # ps I did it ismael
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement