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

निम्नलिखित कोड खंड क्या प्रिंट करेगा?

What will following code segment print ?

a = True
b = False
c = False
if a or b and c:
         print "HELLO"
else:
         print "hello"
A)
B)
C)
D)

Explanation:

The correct answer is:

(A) HELLO

Explanation:

  • The expression a or b and c evaluates the logical conditions.
  • Python evaluates and before or. So, the expression is evaluated as a or (b and c).
  • Since b and c is False (because both b and c are False), the condition becomes a or False, which is True or False, which results in True.
  • Since the condition is True, the if block is executed, and it prints "HELLO".

Output:

(A) HELLO

Latest Updates