NameError: name 'input' is not defined [closed]

0

I do not understand the error in this code ...

def checkio(number):
    #Your code here
    #It's main function. Don't remove this function
    #It's using for auto-testing and must return a result for check.

    number = int(input("Escolha um numero: "))

    while number > 0 and number <= 1000:
        if number % 3 == 0:
            print ("Fizz")
        elif number % 5 == 0:
            print ("Buzz")
        elif number % 3 == 0 and number % 5 == 0:
            print ("Fizz Buzz")
        else:
            print ("É um outro numero!")

    return str(number)

checkio(17)
    
asked by anonymous 05.12.2016 / 21:18

2 answers

2

Try to do this:

python nome_do_seu_arquivo.py

I do not know if you're calling the file directly.

    
05.12.2016 / 21:24
1

You should be using Python2 and not 3, to work in Python2 you should use raw_input

Change this:

number = int(input("Escolha um numero: "))

By:

number = int(raw_input("Escolha um numero: "))

If you are going to migrate to 3 then use input

    
10.12.2016 / 00:02