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 Functions, Packing, and Unpacking Getting Info In and Out of Functions Functions with Arguments and Returns

Hi, I ran into some problems doing this simple code, and it's bothering me.

Write a function called hello_student. This function should receive one argument, name. This function should return one value, the string 'Hello ' followed by the value of the name parameter.

My final code: def hello_student(name): print("Hello "+ name) return

hello_student("Ashley")

Error: Traceback (most recent call last): File "", line 53, in test_results AssertionError: None != 'Hello Ashley' : Whoops, it looks like the string returned from your function is incorrect. Double check spelling and make sure there is a space between words in the returned string.


Ran 1 test in 0.000s

FAILED (failures=1)

I have been able to make it say Hello Ashley in different ways, but it just does not want to take it.

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Okay, let's look at the challenge and break it all down for Task 1:

Write a function called hello_student.

def hello_student:

This function should receive one argument, name.

def hello_student(name):

This function should return one value, the string 'Hello ' followed by the value of the name parameter.

def hello_student(name):
    return 'Hello ' + name

And there it is for Task 1!

Post back if that doesn't make sense.

Happy coding,
Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

James-

I don't believe the challenge is asking for you to print anything. ;-)

You are pretty close, reread the directions and don't add anything else to your function.

Post back if you're still stuck.

Ken

Yeah, I have no idea bro. lol. I do not understand what's wrong.

It worked, I can't believe it was that simple. Sometimes I just try to do more than asked while following the video, and I guess that's what got me. Thank you