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 Input and Coding Style

Holly Bancroft
Holly Bancroft
5,162 Points

When he adds the input function to the variable, then there are parenthesis around the string when there wasn't before?

In the video, we go from first_name = "Ada" to adding the input function to that and asking a question. When he adds the input function, then there are parenthesis also added around the string. I'm thinking this is because the variable now contains a function, but I just want to be sure that's why.

Lucas Garcia
Lucas Garcia
6,529 Points

Hi Holly, Input is a function just like print. So in order to call the function we need to add the parentheses. input() print()

Hope this helps.

1 Answer

Steven Parker
Steven Parker
231,248 Points

The variable doesn't contain the function. The function is being called, and the result is put into the variable.

When calling a function, the function name must be followed by parentheses. If the function takes argument(s), they are placed inside the parentheses. In this case one argument is being passed to the function (the string).