I was receiving the error "NameError: name 'random' is not defined" after using "random.randrange(...)"
make sure to include
at the top of your code
You need to import random
You can't use built in functions without importing it
Yes you need to import it before using it
just like with math too
The reason I was receiving the error was because I forgot to do "import random" before doing "random.randrange(...)". Hence the error saying 'random' is not defined.
I think you forgot to put "import random" at the top of the code like even before def main().
Thank you and i know most of them answered the same thing! So, ya! hehe.
Have a good day!
Gotta get house points somehow xD
HAHA, True xD
Include 'Import random' at the top of your program and that will work.
Hope this helps!