Hey all, Im trying to code dice rolls that all get added together
Two pieces of code here, first bit generates all the numbers and prints then out, the second set of code is me try to get it added all together
please help
#working code
#my best attempt
Two pieces of code here, first bit generates all the numbers and prints then out, the second set of code is me try to get it added all together
please help
#working code
import random def D4(x): for d4 in range(x): d4 = (random.randint)(1,4) print(d4) #eg D4(10)################################################
#my best attempt
import random def D4(x): rolls = 0 for d4 in range(x): d4 = (random.randint)(1,4) rolls = rolls + d4 return rolls def dicetotals(x): print(D4(x)) dicetotals(2)