मराठी

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

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 given
  • myfunc(0)Zero
  • myfunc(2)x is between 0 and 3
  • myfunc(5)x is more than 3
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 8: Exception Handling & Generate Functions - EXERCISE [पृष्ठ १५६]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
पाठ 8 Exception Handling & Generate Functions
EXERCISE | Q 1. | पृष्ठ १५६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×