Mega Code Archive

 
Categories / Python / Function
 

Save function result into a variable

def times(x, y):      # create and assign function      return x * y      # body executed when called x = times(3.14, 4)    # save the result object print x