Nov-07-2016, 07:15 PM
Hello, I am at my wits end trying to solve this problem. When I try to execute my program, the assembler complains that
The purpose of this part of the program is to "roll" 4 six-sided dice, discard the lowest score and sum the remaining 3 scores, repeating this process 6 times.
I'm certain there are better ways to accomplish what I'm trying to do but I'm still learning the language.
total = scores [0] + scores[1] + scores[2]is out of scope. I imagine that
del scores[0]is somehow getting repeated too many times but I don't see how.
The purpose of this part of the program is to "roll" 4 six-sided dice, discard the lowest score and sum the remaining 3 scores, repeating this process 6 times.
I'm certain there are better ways to accomplish what I'm trying to do but I'm still learning the language.
def generateAbilityScores(): i = 0 j = 0 scores = [] pool = [] while i < 6: while j < 4: roll = rollDsix() scores.append(roll) j += 1 scores.sort() del scores[0] total = scores[0] + scores[1] + scores[2] pool.append(total) i += 1