Python Forum
New Pythonista - Syntax Trouble
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New Pythonista - Syntax Trouble
#1
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. ')
Reply
#2
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. ')
Reply
#3
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pythonista on iPad install plotly SwissPython 2 3,200 Oct-28-2020, 06:58 AM
Last Post: Khoitsma
  syntax trouble shooting RadicalRhno353 2 1,773 Sep-11-2020, 08:20 PM
Last Post: RadicalRhno353
  Pythonista script with iPhone's native Clock app Sharkman157 0 2,576 Sep-27-2018, 05:23 PM
Last Post: Sharkman157

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020