Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVrund Patel
11,994 PointsRunning error
name = input("What's your name? ")
if name == "Vrund":
print(name + "is a lumberjack and he's OK!")
else:
print( name + "sleeps all night and works all day!")
I try to run this code in iTerm and it gives me error:
What's your name? Vrund
Traceback (most recent call last):
File "hello.py", line 1, in <module>
name = input("What's your name? ")
File "<string>", line 1, in <module>
NameError: name 'Vrund' is not defined
Vrunds-MacBook-Pro:desktop vrundpatel$
2 Answers
michaelangelo owildeberry
18,173 PointsI am thinking it is a space relation. What happens when you try with no empty lines? =) ... name = input("What's your name? ") if name == "Vrund": print(name + "is a lumberjack and he's OK!") else: print( name + "sleeps all night and works all day!")
michaelangelo owildeberry
18,173 PointsWhere are you putting the {}? =)
Vrund Patel
11,994 PointsVrund Patel
11,994 PointsNope, gives the same error.