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 trialAizah Sadiq
2,434 PointsI don't understand this code challenge
I don't know why val is not defined in my code
def hello_student(name):
val = name
return val
print("Hello", val)
2 Answers
Steven Parker
231,108 PointsYou're close, but the challenge wants you to combine "Hello " with the name in the function and have it return that.
You also won't need to "print" anything for this challenge.
Aizah Sadiq
2,434 PointsI still don`t understand
def hello_student(name):
return( "Hello" + name )
Steven Parker
231,108 PointsAlmost there, but you still need to add a space to keep the words separate (see my example).
Steven Parker
231,108 PointsSteven Parker
231,108 PointsYou need to combine the two strings using concatenation, with a + sign instead of a comma. And you need to add a space to keep the words separate:
return "Hello " + val
Also, you could skip creating the extra variable and just use the parameter directly in the return expression.