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 trialBuster Siem
7,280 PointsThis function is broken. I have no clue how to solve it.
So I ran into the awkwardly formulated code challenge, and I have no clue whatsoever of how I am supposed to be solving this.
Anyways, I hope someone have the know-how of how you're supposed to be writing this code!
def hello_student(name):
hello = "Hello {}".format(name)
return hello
hello_student(Buster)
2 Answers
Steven Parker
231,275 PointsThe argument needs to be a string, and literal strings must be enclosed in quotes.
Also, the instructions say to "save the return value to a variable called hello." So the function needs to be called as part of an assignment to create the new variable.
Devin Lane
4,575 PointsI got tripped up on this too and forgot to pass my argument as a string with quotation marks. Thanks for asking and answering this question!
Buster Siem
7,280 PointsBuster Siem
7,280 PointsThanks, Steven Parker! Iβm not sure if I have understood this correctly, but it didnβt work out when I tried this either:
hello = return("Hello {}".format(name))
(If thatβs what youβre saying...)
Steven Parker
231,275 PointsSteven Parker
231,275 PointsThat looks like the line inside the function, which is OK as is.
I'm talking about the line at the very bottom for task 2: