Skip to content

Instantly share code, notes, and snippets.

@jonbesga
Created August 15, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbesga/cf267cc717c1dc0be77bec7c4b26fbc9 to your computer and use it in GitHub Desktop.
Save jonbesga/cf267cc717c1dc0be77bec7c4b26fbc9 to your computer and use it in GitHub Desktop.
import random
def throwDices(number_of_dice, type_of_die):
results = []
for i in range(0, number_of_dice):
number = random.randint(1, int(type_of_die.split('d')[1]))
results.append(number)
print(results)
number_of_dice = int(input("Number of dice to throw: "))
type_of_die = str(input("What type of die do you want to throw:(dX): "))
throwDices(number_of_dice, type_of_die)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment