Strings in functions


Can anybody help me to find out whats wrong with this.It showing in output Helloworld 2 times and not taking Waynesworld.

n = “Hello”

Your function here!

def string_function(s):
return s

print string_function(n)
print string_function(“Waynes”)


What is n? It doesn’t exist, does it? You want to concatenate the “world” string literal with the incoming string that is in s.


Actually, n is right over here:,

The reason why it’s not printing "Waynes" is also because you assigned it to your variable n, so now, our parameter s now contains the concatenated string: "Helloworld".


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