निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
What will be the output of the following Python code ?
def func(a, b=5, c=10):
print(‘a is’, a, ‘and b is’, b, ‘and c is’, c)
func(13, 17)
func(a=2, c=4)
func(5,7,9)
A)
B)
C)
D)
Explanation:
Here's the breakdown:
-
First call:
func(13, 17)
a = 13
,b = 17
,c = 10
(default).
Output:a is 13 and b is 17 and c is 10
.
-
Second call:
func(a=2, c=4)
a = 2
,b = 5
(default),c = 4
.
Output:a is 2 and b is 5 and c is 4
.
-
Third call:
func(5, 7, 9)
a = 5
,b = 7
,c = 9
.
Output:a is 5 and b is 7 and c is 9
.
Final output:
a is 13 and b is 17 and c is 10
a is 2 and b is 5 and c is 4
a is 5 and b is 7 and c is 9
Answer: (C)