I've got a function:
def user_login(m):
m = "user_login function called"
return m
Calling it with:
user_login(message)
It should change a string, m, and return the result. I know that the function gets called because it throws up an error [user_login() takes exactly 1 argument (0 given)] if I don't put an argument in it. But it doesn't return a string. How can I find out what's wrong?
asked Oct 28, 2012 at 19:00
babbaggeii
7,77721 gold badges69 silver badges121 bronze badges
1 Answer 1
You can't "change the string" - instead, what you should be doing, is assigning the result of the function to your string in the calling scope:
m = user_login('some message')
print m
answered Oct 28, 2012 at 19:02
Jon Clements
143k34 gold badges254 silver badges288 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py