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 Meet Python Using Input

Locke Hoganson
Locke Hoganson
67 Points

how do i use the input feature

using_input.py
favorite_color = 'input'

print ``What is your favorite color ``

2 Answers

Steven Parker
Steven Parker
231,198 Points

Since input is a function, using it will involve putting its name followed by parentheses that hold an argument. The argument is what you want the user to see before the user types something, which is known as a prompt.

Take another look at this part of the Input and Coding Style video for an example of it being used in a program.

Kevin Peltier
Kevin Peltier
9,406 Points

I am still pretty new to this, but I believe the answer you are looking for is this.

you need to assign a question to the input method. like this:

favorite_color = input('what is your favorite color? ')

then if you want to print that result to the repl:

print('your favorite color is {}".format(favorite_color))

make sure to use .format to assign the answer that was given to the input.

hope this helps a little. if you need me to explain more, let me know and I can try to help.