ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(len('') or 'empty', [] or 'none')- A. 0 none
- B. empty []
- C. 0 []
- D. empty none
Correct answer: D. empty none
len('') is 0, which is falsy, so or returns 'empty'. The empty list is also falsy, so the second value is 'none'.
More Python Programming questions
- 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))…
- What is printed? python print(0.2 + 0.4 + 0.1 == 0.7, 0.1 + (0.2 + 0.4) == 0.7, 0.2 + 0.1 + 0.4 == 0.7)