help with a D&D 5e stat generator in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help with a D&D 5e stat generator in python

I have the code to create a single stat and I could just copy and paste that code and change the variables but I know there has to be a better way to do it. basically what I have now is: create a list, call a function to generate 4 numbers between 1 and 6 and then add them to the list, then remove the smallest number and add the list together. how could I loop this to run 5 more times? here is a link to the code on the code playground https://code.sololearn.com/ccWluc8EK24N/#py hope that link works

24th Nov 2020, 11:49 PM
David Aseltine
David Aseltine - avatar
2 Answers
+ 1
It will be hard to code the last bit in Sololearn, but to achieve it you would have to get user input for each stat using the list of rolls as possible choices. I would use an actual generator and "yield" each key asking the user for an update. I hope this helps. https://code.sololearn.com/c8js7DMisH02/?ref=app
25th Nov 2020, 1:28 AM
Steven M
Steven M - avatar
0
Steven M thank you that helps a lot
25th Nov 2020, 1:36 AM
David Aseltine
David Aseltine - avatar