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

AssertionError: ('Hello ', 'Ashley') != 'Hello Ashley'

The question suggests a spelling error? I've read it over a dozen times and I can't find the issue.

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

1 Answer

Eric Ryan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Eric Ryan
Python Development Techdegree Graduate 26,123 Points

When you concatenate in Python a comma automatically adds a space between the strings you are concatenating. However, by using parentheses and a comma you are actually returning a tuple, not a concatenated string. So you can correct it by removing the space in β€˜Hello β€˜ and the parentheses or you can use the + operator to concatenate the string.

Michael Hulet
Michael Hulet
47,913 Points

I don't think the comma operator is a concatenation operator in Python. The comma is what makes the tuple, no parentheses required. The rest of your answer is spot-on, though

Eric Ryan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Eric Ryan
Python Development Techdegree Graduate 26,123 Points

Michael Hulet, yes, my mistake. Within a print function a comma will behave as I stated in my answer. I’m not sure if it works the same way anywhere else. But you’re right, it’s the comma that makes the tuple, not the parentheses.