Strings in functionS


#1

https://www.codecademy.com/courses/python-beginner-nzzVa/1/3?curriculum_id=4f89dab3d788890003000096#

When I run the code, the console prints "Helloworld" as it should. But then it gives my an error that says "Oops, try again. string_function('Waynes') returned 'Helloworld' instead of 'Waynesworld'."

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

print string_function(n)

#2

Think about why it would use Wayne instead of Hello and then look at your code and see if you're doing that

Your function as described in the instructions is supposed to concatenate the argument and "world", and return the result. If your function ignores the argument given to it, then it will not be able to do so.


#3

Thank you! I got it! Now it passed.

It concatenate the variable n instead of the argument s.

Thanks againg!


#4

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