Lists and Functions, 7. Strings in functions


Hi, I recognize this exercise should be easy but I've gotten myself all mixed up and I can't find the specific earlier exercise that reviews the topic. My code is below. The return window prints "Hello world" and the error message doesn't make sense to me. Please assist if possible. Thanks.

Oops, try again. string_function('Hello') returned 'Hello world' instead of 'Helloworld'

n = "Hello"
# Your function here!
def string_function(s):
    add = (n + " world")
    return add

print string_function(n)


Well your error message is telling you that you have a space you don't need.

There is a space between " and world", so you need to get rid of it so it's one word not two.
Additionally, add should add the parameter and "world", not your variable n. :slight_smile:


Got it, thank you very much.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.