R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is the output?

Code:
def square(x):
return x*x

print(square(-2))
  • (A) -4
  • (B) 4
  • (C) 2
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 11
  • Filed under category Python
  • Hashtags:

Explanation by: Ram Sharma
(-2) * (-2) = 4.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.