R

Ram Sharma • 3.40K Points
Extraordinary

Q. What will be the output of the following code?

Code:
def f():
return 'Hello'

f = 10
print(f)
  • (A) Hello
  • (B) 10
  • (C) f
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 5
  • Filed under category Python
  • Hashtags:

Explanation by: Ram Sharma
The function `f` is overwritten by the integer 10, so `print(f)` prints 10.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.