ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(5 <= 5 < 6 != 7, 1 < 2 > 3)
- A. True True
- B. False False
- C. True False
- D. False True
Correct answer: C. True False
Chained comparisons check each adjacent pair. The first chain holds because 5 <= 5 < 6 and 6 != 7. The second fails at 2 > 3.
More Python Programming questions
- What is printed? python print(len('') or 'empty', [] or 'none')
- What is printed? python a = [1, 2, 3] b = a[:] a.append(4) print(len(a), len(b))
- What is printed? python print(list(filter(lambda s: s.startswith('a'), ['ab', 'ba', 'ac'])), ' a b '.strip().split(' '))
- What is the time complexity of x in d where d is a collections.deque of n items?
- What is printed? python x = 10 print(x.bitlength(), (x >> 1).bitlength(), (x << 3) // 16)
- What is printed? python words = ['tea', 'eat', 'tan', 'ate', 'nat'] groups = {} for w in words: groups.setdefault(''.join(sorted(w))…