Ask Your Question

Revision history [back]

A programing question

Hello!

I would like to define a procedure, which puts values in a dictionary:

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

Now if I am outside the procedure, I cannot use the values of u's... Is there a method for that outside the procedura I can use these specific u's?

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

print u[Cathy]

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

Many Thanks!

A programing question

Hello!

I would like to define a procedure, which puts values in a dictionary:

def put: u={} enter code hereu={} u[Cathy]=3232556 u[John]=4256342

Now if I am outside the procedure, I cannot use the values of u's... Is there a method for that outside the procedura I can use these specific u's?

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

put

print u[Cathy]

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

Many Thanks!

A programing question

Hello!

I would like to define a procedure, which puts values in a dictionary:

def put: enter code hereu={} u={} u[Cathy]=3232556 u[John]=4256342

Now if I am outside the procedure, I cannot use the values of u's... Is there a method for that outside the procedura I can use these specific u's?

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

put

print u[Cathy]

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

Many Thanks!

A programing question

Hello!

I would like to define a procedure, which puts values in a dictionary:

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

Now if I am outside the procedure, I cannot use the values of u's... Is there a method for that outside the procedura I can use these specific u's?

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

put

print u[Cathy]

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

Many Thanks!

A programing question

Hello!

I would like to define a procedure, which puts values in a dictionary:

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

u[John]=4256342

Now if I am outside the procedure, I cannot use the values of u's... Is there a method for that outside the procedura I can use these specific u's?

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

u[John]=4256342 put

put

print u[Cathy]

print u[Cathy]

Traceback (click to the left of this block for traceback) ... SyntaxError: invalid syntax

syntax

Many Thanks!