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 trialavery koon
5,316 PointsCode editor not correctly validating python code
Hey guys,
I’ve entered a number of correct answers to this question but it’s prompting me to recheck work stating it’s invalid. The exercise is just asking to make a function that returns “hello “ along with a name, but it continues to bomb out. My answers have been:
def hello_student(name): mess = print(“Hello “ +name) return mess
def hello_student(name): print(“Hello “+name)
def hello_student(name): print(f”Hello {name}”)
Each followed by hello_student(“Timmy”) in any editor i know and they all print out “Hello Timmy” or anything i assign to in the editor. Feel free to respond/update in the comments. Thanks in advance
def hello_student(name):
print("ello "+name)
1 Answer
Indiya Gooch
12,075 PointsI understand where you're coming from, the challenges question confused me a little too, but when it says "return" it did literally mean return not print. It got me too. Your answers were fine, just not what it was after. Hope this helps. EI:
def hello_student(name):
return "Hello "+ name