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 trial

Python Python Basics (Retired) Ins & Outs Ins & Outs

what is a string

i dont understand the question

name.py
name = "what is your name?" 

if name == "michael":
  print("{} is a boss" .format(name))
else:
  print("{} is not a boss" .format(name))

treehouse = "what is "
if treehouse == "tree, house":
  print(" {} house" .format(treehouse))

I edited your post. Tone it down on the language. This isn't the right community for that.

1 Answer

Drew Butcher
Drew Butcher
33,160 Points

I believe in the first line you want

name = input("what is your name? " )

that way the when the program runs the user will be ask there name and it will be stored in the name variable.

In your if condition you don't want a space between the string and the function format... in other words it should look more like this:

if name == "michael":
  print("{} is a boss".format(name))
else:
  print("{} is not a boss".format(name))

The above code will print out 'michael is a boss' if the user inputs michael; otherwise, your output will be the input from the user with 'is not a boss'.

In the last statement, again you don't want a space between the string " {} house" and .format(treehouse); in other words it should look like:

treehouse = "what is "
if treehouse == "tree, house":
  print(" {} house".format(treehouse))

However this statement will not print out anything because the variable treehouse is assigned the value "what is" which is not equal to the value "tree, house".