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

i wanna make two .formats meaning 2 {} {} how do i do that

i wanna make two .formats meaning 2 {} {} how do i do that

1 Answer

Something you can do is this: paste the stuff below. dont copy the text in bold.

value_1 = "Potatoes"
value_2 = "Cookies"

print("Test!!! {} and {} are my favorite!".format(value_1, value_2))

Instead of Potato or cookie, you can ask a question with input() to define the variable.

you use .format(variable, next variable, ..., ..., etc) after the quotation.

if you only want one, just do .format(value_1)

you just separate your variables by a comma, then space, then next variable. hope this helps.