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 String Formatting

Yuya Kawahara
Yuya Kawahara
825 Points

Cannot figure out what I am doing wrong

name = input("What`s your name? ")

if name == "Kenneth": print("{} is a lumberjack and he/she`s OK!", format(name)) else: print("{} sleeps all night and {} works all day!", format(name, name))

2 Answers

Hi Yuya Kawahara,

in python you are calling a method by using the dot operator. Try to replace the comma with a dot and put no whitespace between the string, the dot and the format method. So it should look something like this:

print "some string in here {}".format(some_variable)

there is no comma before format it should be a full stop.

i.e. "{} blah blah".format(name)