In this tutorial I'm following this program that asks the user for their name, and then responds with hi" + name
. I followed the instructions but it isn't accepting inputs. Is the tutorial wrong/outdated?
print ("Hi! I’m Joseph. What's your name?")
name = input()
print ("Hi" + name)
It’s supposed to respond with a literal Hi
and then the name
but instead I am shown this:
Traceback (most recent call last):
File "C:/Users/user/Documents/AA school/ICT/python/Using str variables.py", line 2, in <module>
name = input()
File "<string>", line 1, in <module>
NameError: name 'Adam' is not defined
I've tried changing the + name
to + str(name)
, and putting spaces in and removing them from different areas of the code.
What’s wrong?