R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does this function return?

Code:
def check(x):
if x > 0:
return 'Positive'
else:
return 'Non-positive'

print(check(-5))
  • (A) Positive
  • (B) Non-positive
  • (C) -5
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 5
  • Filed under category Python
  • Hashtags:

Explanation by: Ram Sharma
Since -5 is not greater than 0, the function returns 'Non-positive'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.