Python Forum

Full Version: New Pythonista - Syntax Trouble
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm very new to python and trying to make a sort of gLaDOS chatbot, can someone show me why I'm getting syntax errors with this piece of code? The program highlights the userage in the bottom line when I attempt to run it.
print('Hello and, again, welcome to the Aperture Science computer-aided enrichment center. ')
print ('I am gLaDOS, the most advanced AI to plop from Gabens asshole, who are you? ')
username = input()
print (username + '? Hmm, what a.. peculiar name. ')
print ('When were you manufactured? ')
userage = input()
print userage + (' years wasted, proceed to the incineration chamber for recycling. ')
I suspect that you're using Python 3 and that the last line
 print userage + (' years wasted, proceed to the incineration chamber for recycling. ')
should probably be
 print(userage + ' years wasted, proceed to the incineration chamber for recycling. ')
Not sure if it's possible to mention people with @ or u/ here. Hopefully this is seen anyways! Thank you Micseydel, that solved my problem. I'll be sure to mention the version of python I am using in any further posts.

Thank you for the advice Mekire, I'll be sure to use that function in future. I apologise for any inconviences!