I have some code that looks something like this:
import random
n = 0
while n <= 50:
n = n+1
a = random.randint(1, 16)
b = random.randint(1, 5)
print n, ". ", a, "-", b, "= "
For some reason, when running it, I get the following error:
AttributeError: 'module' object has no attribute 'randint'.
However, I have no problems when running the same random.randint
codes in IDLE.
How can I fix this?