Ask Your Question

Revision history [back]

To clarify some of the comments: here is an example using "return", and returning a tuple of items rather than a single one: You tell the function to return the internal values u and v, and then when you call the function, you can store the output in any variable you want (a and b, in this case).

def put(): 
   u={}
   u['Cathy']=3232556
   u['John']=4256342

   v={}
   v['Bill']=7639867
   v['Amy']=3528520
   return (u,v)

sage: a,b = put()
sage: a
{'Cathy': 3232556, 'John': 4256342}
sage: b
{'Amy': 3528520, 'Bill': 7639867}