NameError: name 'random' is not defined

python, python-3.x

Solution

You have to import the module `random`:

import random

r = random.randint(1,10)
# ...

Problem

Here is my code: ``` r = random.randint(1,10) ``` But for some reason it's giving me the error NameError: name 'random' is not defined Other info: Mac, Python, 3.4.0 pylauncher

Original source