हिंदी

What would be the output of the following code? def evenNumber (number): assert (number % 2 == 0), "not even" print ("Number is even")evenNumber (7) -

Advertisements
Advertisements

प्रश्न

What would be the output of the following code?

def evenNumber (number):
           assert (number % 2 == 0), "not even"
           print ("Number is even")
evenNumber (7)

विकल्प

  • No output

  • Not even

  • Number is even

  • Assertion Error: not even

MCQ

उत्तर

Assertion Error: not even

Explanation:

The number seven is not even. AssertionError is raised because the remainder for 7/2 is not zero.

shaalaa.com
Built-in Exceptions
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×