Hey, I'm new to python so don't judge.

Steve D'Aprano steve+python at pearwood.info
Tue Jan 3 19:15:56 EST 2017

On Wed, 4 Jan 2017 12:04 pm, Callum Robinson wrote:

> Traceback (most recent call last):
>   File "D:/Python/random.py", line 6, in <module>
>     computer_number = number.randint(1, 100)
> NameError: name 'number' is not defined

That's exactly what we need to see! The full traceback, thank you!

You're asking Python to get the variable "number", and call the randint method. 

- you don't have a variable called "number";

NameError: name 'number' is not defined

- and even if you did, that's not how you get a random number. What you want

computer_number = random.randint(1, 100)

â £Cheer up,â Ø they said, â £things could be worse.â Ø So I cheered up, and
enough, things got worse.

More information about the Python-list mailing list