Python printing a procedure -
i trying print procedure in python. how print it? here code
def proc(a,b): if test(a): homecoming b homecoming print proc(a,b) but error:
nameerror: name 'a' not defined
thanks in advance.
a name of local variable used hold value of first argument passed function when called. when calling it, need actual value, or variable defined in scope function called. example:
def proc(a,b): if test(a): homecoming b homecoming x = 6 print proc(x, 7) now when proc called, value of variable x , value 7 passed proc. within proc, a have same value x (at time of call) in calling scope, , b have value 7.
python printing
No comments:
Post a Comment