Stuck on Strings in functions 7/18


I follow the instructions but this error pops up

Oops, try again. string_function('Waynes') returned 'Helloworld' instead of 'Waynesworld'

so when I change up the code, this error pops up
Oops, try again. string_function('Hello') returned 'Waynesworld' instead of 'Helloworld'

the code does exactly what the instructions say, but it says I'm wrong no matter how I change it.

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

print string_function(n) 
#error pops up that I returned Helloworld instead of Waynesworld. When I change it, it says I returned Waynesworld instead of Helloworld....


The idea is that string_function("Waynes") should return "Waynesworld" and string_function("Hello") should return Helloworld. So should string_function(n) because the value of n is "Hello".

The important thing is that the return value of string_function should have nothing to do with the value of n (unless you happen to pass n as the parameter). So you should not use n inside the function.


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