Python Forum
New Pythonista - Syntax Trouble - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: New Pythonista - Syntax Trouble (/thread-13115.html)



New Pythonista - Syntax Trouble - sparkelyfox - Sep-28-2018

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. ')



RE: New Pythonista - Syntax Trouble - micseydel - Sep-28-2018

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. ')



RE: New Pythonista - Syntax Trouble - sparkelyfox - Sep-29-2018

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!