Advertisements
Advertisements
प्रश्न
What all can be possible outputs of the following code?
def myfunc(x=None):
result = ""
if x is None:
result = "No argument given"
elif x == 0:
result = "Zero"
elif 0 < x <= 3:
result = "x is between 0 and 3"
else:
result = "x is more than 3"
return resultकोड लेखन
Advertisements
उत्तर
The possible outputs are:
No argument given
Zero
x is between 0 and 3
x is more than 3
For example:
myfunc()→No argument givenmyfunc(0)→Zeromyfunc(2)→x is between 0 and 3myfunc(5)→x is more than 3
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
