-
-
Save marksteve/f5ed32147cef7e99b0ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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