Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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".