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

Functions, Packing, and Unpacking Task 1/2

I am not sure what is wrong here. I tried many different ways and keep getting the challenge wrong. I submitted this code and received the following:

"Bummer: 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."

creating_functions.py
def hello_student(name):
    print('Hello ',name)
    return 

4 Answers

Steven Parker
Steven Parker
231,236 Points

You're close, but the function should return the string. You won't need to "print" anything.

I guess I read to much in to it, and being up for 18+ hours doesn't help. I solved the problem thanks for the help!

Paul C
Paul C
2,668 Points

James I was wondering the same thing. I was trying it with my name, because it does not specify you need to use the instructors name, and it was not working.

I think because this course is new they are still sorting out the bugs. Eventually I came up with this solution:

def hello_student(name):
    name = 'Ashley'
    return 'Hello ' + name
    #Note the space after the 'o' in 'hello'.

Floyd, I did the same code except I left out line 2 and it accepted the solution.

The new challenges definitely lack some specifications but it has helped me learn by exhausting all my resources before throwing in the towel.

def hello_student(name):
     return 'Hello ' + name
Steven Parker
Steven Parker
231,236 Points

The "name" is supplied as an argument, it should not be set to a fixed value inside the function.

Christopher Sullivan
Christopher Sullivan
4,230 Points

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

hello = hello_student("Chris")

I found this to work for me.

Dennis Montegnies
Dennis Montegnies
1,112 Points

Can anyone explain me why

def hello_student(name):
    return ('hello ', name)

is not accepted as a solution?

Steven Parker
Steven Parker
231,236 Points

You'll need to use concatenation or string formatting to join the parts. Separating two items with a comma in a "return" causes it to return a tuple instead of a longer string.