Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created May 7, 2023 09:20
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 stephengruppetta/d811e29b7096096d6f97cbe5d38ef281 to your computer and use it in GitHub Desktop.
Save stephengruppetta/d811e29b7096096d6f97cbe5d38ef281 to your computer and use it in GitHub Desktop.
import random
def roll_dice(max_value, number_of_dice):
return [
random.randint(1, max_value)
for _ in range(number_of_dice)
]
# Roll two six-sided dice
print(roll_dice(6, 2))
# Roll four ten-sided dice
print(roll_dice(10, 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment