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 trialKeegan Swanson
1,339 PointsFunctions with arguments and returns
This is extremely difficult, and I don't understand it. Please help.
def hello_student(name):
return name
print(Hello, name)
1 Answer
Steven Parker
231,275 PointsHere's a few hints:
- all the work for task 1 should be done inside the function
- literal strings (not in a variable) must be enclosed in quotes
- the
"Hello "
should be combined with the name as part of the return value. - you won't need to "print" anything
Keegan Swanson
1,339 PointsKeegan Swanson
1,339 PointsWhat? This still doesn't make sense.
Steven Parker
231,275 PointsSteven Parker
231,275 PointsSome additional hints for the other hints:
"Hello "
needs quotes around it"Hello "
needs to be combined with the name into a larger stringAnd when you get to task 2, you will use the function you made for task 1 and assign the result to a variable.
You still won't need "print".
Keegan Swanson
1,339 PointsKeegan Swanson
1,339 PointsThank you for the help on task one, I got through it, but now I need a little help on task two.
Steven Parker
231,275 PointsSteven Parker
231,275 PointsAs I mentioned before, task 2 basically is calling the function previously defined, and assigning the result to a variable.