Strings in functions


n = “Hello”

Your function here!

def string_function(s):
return n + “world”

print string_function(n)

#whats wrong?
error:Oops, try again. string_function(‘Waynes’) returned ‘Helloworld’ instead of ‘Waynesworld’


Hi try to change return n + "world" like that

return s + "world"


Thank you, that worked for me! I don’t get it though, can you explain?


Hi its work like that

First you declare a variable num and store " Hello" then you write a function with one argument which is s and the function return

return s + "World"

So when you call the function with n


the n take the place of s inside the function and since we saved inside n Hello the call function print


Hello Word 


Ohhh, I see. Thank you!


thank you for the explanation. [this exercise seems simpler than it is]