🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

print(bool(0), bool(3.14159), bool(3), bool(1.0+1j))
A)
B)
C)
D)

Explanation:

Let's break down the code:

print(bool(0), bool(3.14159), bool(3), bool(1.0+1j))

Explanation:

  • bool(0): In Python, 0 is considered a falsy value, so bool(0) is False.
  • bool(3.14159): Any non-zero number (including floats like 3.14159) is considered truthy, so bool(3.14159) is True.
  • bool(3): Similarly, any non-zero integer is considered truthy, so bool(3) is True.
  • bool(1.0 + 1j): A non-zero complex number (like 1.0 + 1j) is also considered truthy, so bool(1.0 + 1j) is True.

Output:

(D) False True True True

Latest Updates