Hey, I'm new to python so don't judge.
Callum Robinson
cr2001 at hotmail.co.nz
Tue Jan 3 20:25:13 EST 2017
On Wednesday, January 4, 2017 at 2:16:08 PM UTC+13, Steve D'Aprano wrote:
> 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. But:
>
> - 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
> is:
>
> computer_number = random.randint(1, 100)
>
>
>
>
>
>
> --
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
Hey man thanks, the sad thing is i have no idea why i put that in. I must be having a terrible day.
More information about the Python-list
mailing list