Lists and Functions, 7. Strings in functions


#1

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.

ERROR:
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)


#2

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:


#3

Got it, thank you very much.


#4

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