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 trialCarlos Muñoz Sanchezllanes
4,407 PointsAm I indenting correctly? or did I add too many choices in the else section?
So everything in my code is going great (at least I'm hoping? ._.) .. until I reach line 14 and its stating file "hello.py", line 14, in <module> print("Welcome, commoner of the poor lands of", first_place)
TypeError: 'str' object is not callable
on top of things its not wanting to take my next command on line 13! (Sad hamster!) Can anyone be so kind to help me out on what I'm doing wrong. Much obliged!! Thank you!!
heres what i have:
first_place= input("What fair land do you arrive from? ")
if first_place == "Narnia":
print("Away with you, foul beast!")
elif first_place == "Skyrim":
print(first_place, "is the stepping stones of the gods! You may enter!")
elif first_place == "Neverland":
print("You need to grow up and get some booty!")
else:
sword_play= int(input("Before you go your way, tell me how many years have you wielded your blade? "))
if sword_play <= 6:
print("{} HAHA, Now I'm sure death will come to you sooner.".format(sword_play))
elif sword_play >7:
print= ("You say {}? I say you could make a name for yourself in these lands.".format(sword_play))
print("Welcome, commoner of the poor lands of", first_place)
print("Now, go on your way!")
ps: I'm kinda of a noob and don't know how snip or copy things over! So an explanation of how i may go about it would be awesome!! (I know, I'm asking for a lot but I would appreciate it with the highest appraisal!.-. )
2 Answers
Richard Verbraak
7,739 PointsSo after running your code in an online tool. I noticed you added an equals sign = right before print.
print= ("You say {}? I say you could make a name for yourself in these lands.".format(sword_play))
If you remove that it will run just fine!
Richard Verbraak
7,739 PointsHey I'm not really familiar with Python but you can use 3 backticks to get your code properly formatted.
They are on the tilde symbol (under the escape key or on the left side of your 1 on the keyboard).
Just 3 before your code and 3 after!
Carlos Muñoz Sanchezllanes
4,407 PointsOMG! thats awesome! Thank you so much!! high fives you with raccoon hands!
Carlos Muñoz Sanchezllanes
4,407 PointsCarlos Muñoz Sanchezllanes
4,407 PointsYou are fine gentleman indeed! thank you so much! I guess I needed a fresh pair of eyeballs!!!! evil squirrel laugh, but no really, thank you! ._.