Skip to content

Instantly share code, notes, and snippets.

@marksteve
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save marksteve/f5ed32147cef7e99b0ce to your computer and use it in GitHub Desktop.

Select an option

Save marksteve/f5ed32147cef7e99b0ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import random
import sys
if __name__ == "__main__":
random.seed()
for i, dice in enumerate(sys.argv[1:]):
sys.stdout.write("Dice {}\n".format(i + 1))
rolls, faces = map(int, dice.split('d'))
for j in range(rolls):
roll = random.randint(1, faces)
sys.stdout.write(" Roll {}: {}\n"
.format(j + 1, roll))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment