Error in lesson(recap of string in function)


#1

Dear Sir,
can you check for me where i did wrong because as per this question i need to return the value of function argument with word Hello , i did by two way but still it showing me error.

My codes:

n = "Hello"

Your function here!

def string_function(s):
#return "%sworld"%n
return n+"world"
print string_function(n)

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

My regards,
TBIKU


#2

your function currently only works for one string, what if we add a second function call:

print string_function(n)
print string_function("Waynes")

the second function call doesn't print the correct output while it should

function which only for a single string, is not really good use of functions

importing your function into the different script will give n undefined error


#3

can you escalate with correct please because still i didn't get it.


#4

nope, i can't. The argument you supply at function call gets copied into the function parameter, so maybe can use the function parameter in the function?


#5

@stetim94

I got with below code. thanks' boss.

n = "Hello"

Your function here!

def string_function(s):
#return "%sworld"%n
return s+"world"
print string_function("Waynes")

My regards,
TBIKU


#6