I’m learning Python, and I am up to the chapter on functions, and I wrote code for one:
import random
def roll(sides, dice):
result = 0
for rolls in range(0,dice):
result += random.randint(1, sides)
return result
but, when I try to enter the function, this comes up
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
roll ()
TypeError: roll() takes exactly 2 positional arguments (0 given)
You need to put in numbers between the (). Like roll(3, 1)