Last active
December 1, 2019 07:22
-
-
Save mike-pete/95cf531fb82ccf9efc0ad468024c223b to your computer and use it in GitHub Desktop.
This Python script lets you quickly roll stats for a new D&D character.
This file contains 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
from random import randint | |
# roll 4 d6 and drop the losest val | |
def rollStat(): | |
rolls = [] | |
for i in range(4): | |
rolls.append(randint(1, 6)) | |
rolls.sort(reverse=True) | |
topThree = rolls[0:3] | |
print(' + '.join(str(x) for x in topThree) + ' = ' + str(sum(topThree))) | |
for i in range(6): | |
rollStat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment