Vidyalelo
Python · Q147

Functions in Python

Programming · Python · question 147

Q147

What will be the output of the following Python code? x = 5 def f1(): global x x = 4 def f2(a,b): global x return a+b+x f1() total = f2(1,2) print(total)

A.
Error
B.
7
Answer
C.
8
D.
15

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board