What would be the output of the follow-ing ? Explain. [CBSE Text Book]
def fl(): n = 44 def f2 (): n = 77
print "value of n", n () print "value of n", n
Answers
Answered by
0
filter_none. edit close. play_arrow. link brightness_4 code ...
PEOPLE ALSO ASK
Answered by
0
Given:
def fl(): n = 44 def f2 (): n = 77
print "value of n", n () print "value of n"
To find:
The output
Solution:
def fl():
n = 44
def f2 ():
n = 77
print ("value of n", n ())
print ("value of n", n)
OUTPUT:
Name Error
n is not defined
because any of the two functions is not called there is no value assigned to ‘n’
In fact n is not initiated as it had not yet declared
So the variable is not available according to python interpreter
Similar questions