Hello all…a newbie question if you don’t mind.
Like below:
def plus_it(a, b):
result = a + b
if result == 0:
aa = '0'
#print aa an option here
else:
aa = 'the result is ' + str(result)
#print aa an option here
plus_it(5, 6)
print aa
I can add on print ‘aa’ lines inside the function. However if I want to use the ‘aa’ outside the function like above, it gives an error:
NameError: name 'aa' is not defined
How can I use the ‘aa’ outside the function?
Thanks.