Advertisements
Advertisements
प्रश्न
What will be the output of the following code?
c = 10
def add():
global c
c = c + 2
print(c,end='#')
add()
c=15
print(c,end='%')विकल्प
12%15#
15#12%
12#15%
12%15#
MCQ
Advertisements
उत्तर
12#15%
Explanation:
- Initially,
c = 10. - The
add()the function is called.- Inside
add(), the global variablecis incremented by 2 (c = 12). print(c, end='#')prints12#.
- Inside
- After the function call,
cis reassigned to15. print(c, end='%')prints15%.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
