Advertisements
Advertisements
प्रश्न
Write the output of the code given below:
a = 30
def call (x):
global a
if a%2==0:
x+=a
else:
x−=a
return x
x=20
print (call (35), end="#")
print (call (40), end="@")लघु उत्तरीय
Advertisements
उत्तर
Output:
65#70@
Explanation:
The call() method examines the value of the global variable a. Because a is 30 and 30 % 2 returns 0 in both function calls, the expression x+=a is executed, resulting in the numbers 30 + 35 and 30 + 40 in the respective calls.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
