Python Python Basics Types and Branching Comparisons

Carlos Muñoz Sanchezllanes
Carlos Muñoz Sanchezllanes
4,065 Points

Am 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
Richard Verbraak
7,688 Points

So 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!

Carlos Muñoz Sanchezllanes
Carlos Muñoz Sanchezllanes
4,065 Points

You 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! ._.

Richard Verbraak
Richard Verbraak
7,688 Points

Hey 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
Carlos Muñoz Sanchezllanes
4,065 Points

OMG! thats awesome! Thank you so much!! high fives you with raccoon hands!