"Build a Simple Android App (2014)" was retired on August 31, 2016. You are now viewing the recommended replacement.

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 (2015) Python Data Types String Formatting

how do you use the .format method without printing

I cant figure out how to use the .format method

strings.py
name= "daniel"
subject = "Treehouse loves {}" .format(daniel)

2 Answers

Jeff Wilton
Jeff Wilton
16,646 Points

Just a couple of tiny issues.

1) your variable is named 'name', so pass that into your format method (instead of daniel).

2) remove the space between the double quotes and .format

name= "daniel"
subject = "Treehouse loves {}".format(name)

You are super close!

In the .format field, put your variable in instead of your name.

In your case, it should look like this

name= "daniel"

# if you notice, I have replaced your mistake in the brackets in .format() for the variable 'name'
subject = "Treehouse loves {}" .format(name)

I hope this helps Daniel!