pythongeany

Basic Python on Geany error


When running this simple python program on Geany (I am just learning how to program for the first time):

name = input(What is your name?: ")
age = int(How old are you?: "))
year = str((2017 - age) + 100
print(name + "will be 100 years old in the year " + year)

I get this error:

C:\WINDOWS\system32' is not recognized as an internal or external command, operable program, or batch file.

Can anyone help me get this working?


Solution

  • Your code doesn't run because you were missing multiple quotes, parentheses, and a method.

    My file is as such:

    name = raw_input("What is your name?: ")
    age = input("How old are you?: ")
    year = str((2017 - age) + 100)
    print(name + "will be 100 years old in the year " + year)
    

    Also, your filename doesn't have any extension so Geany has no clue that it's a Python file. So it just tries to run it and fails because it has no proper command to run the file.

    If you resave the file with a .py extension, it specifies to Geany that it needs to run the file using the Python command.