Ask Your Question

Revision history [back]

You can do something like this:

def put(): 
   global u   # this makes 'u' available outside of this function
   u={}
   u['Cathy']=3232556
   u['John']=4256342

sage: put()
sage: u
{'Cathy': 3232556, 'John': 4256342}
sage: u['Cathy'] = 12
sage: u
{'Cathy': 12, 'John': 4256342}