String in functions


#1



Replace this line with your code.


n = "Hello"

Your function here!

def string_function(s):
add = (n + "world"):
return add
print string_function(hello)


#2

Try using s instead of n inside your function and using n instead of hello in the function call.

Whenever you call a function with a parameter(string_function(n)), the value of the argument you enter("hello") is assigned to the parameter(s). So s = n = "hello" and you can use this value(s) inside the function to accomplish what the function was designed to do.


#3

no that doesn't work


#4

n = "Hello"

Your function here!

def string_function(s):
add=(s + "world"):
return add
print string_function(hello)


#5

You're still hard-coding "Hello" rather than using n
The instructions may want you to return the concatenated string itself rather than a variable assigned to the string.


#6

This works you just put n instead of s:)
n = "Hello"

def string_function(n):
z= n+"world"
return z

print string_function(n)


#7

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