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

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

What is the output of the following code ?

a = 15
b = 6
print(a and b)
print(a or b)
A)
B)
C)
D)

Explanation:

Let's break down the code and the logic behind it:

a = 15
b = 6
print(a and b)
print(a or b)

Explanation:

  1. a and b:

    • In Python, the and operator returns the second operand if the first operand is truthy (non-zero).
    • Since a = 15 (a non-zero value, which is truthy), the result of a and b is b, which is 6.
  2. a or b:

    • The or operator returns the first truthy operand it encounters.
    • Since a = 15 is truthy, the result of a or b is a, which is 15.

Output:

(C) 6 15

Latest Updates