Thread: Variables
View Single Post
Old Aug 9th, 2005, 7:26 AM   #2
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Smile

You have a function that returns something so you need to assign it to a variable when you call it. This should do it:
#defining the variable
msg = "Hello"
#function to change the msg variable to the argument in the funtion
def changeit(new):
	msg = new
	return msg
#calling the function with the argument "goodbye"
msg = changeit("Goodbye")
#Printing the variable to check that it has changed acording to the function that we called
print msg
__________________
I looked it up on the Intergnats!
Dietrich is offline   Reply With Quote