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

How do I do this without the input function?

I'm lost. Where am I going wrong? Thank you!

name.py
name = "Marc"
treehouse = "Tree" + "house"
email_greeting = input("{} loves {}".format(name,treehouse))

2 Answers

Matthew Rigdon
Matthew Rigdon
8,223 Points

Input requests a response from the person behind the computer, which in this case, you don't need. I would modify your code to look like something like this:

name = "Marc"
treehouse = "Tree" + "house"
email_greeting = "{} loves {}".format(name, treehouse)

This uses your idea of formatting the string as you originally planned.

Bart Bruneel
Bart Bruneel
27,212 Points

Hello Marc,

You don't need the input function for this. The input function is used when asking the user of a program for an input. All you need here is string concatenation, meaning tying different strings together. It works like this:

email_greeting=treehouse + ' loves '+ name.