ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print([i * j for i, j in zip(range(3), range(3, 0, -1))])
- A. [0, 2, 2]
- B. [3, 2, 1]
- C. [0, 1, 2]
- D. [0, 2, 4]
Correct answer: A. [0, 2, 2]
The pairs from zip are (0, 3), (1, 2) and (2, 1), so the products are 0, 2 and 2.
More Python Programming questions
- What is printed? python print(''.join(chr(ord('a') + (ord(c) - ord('a') + 3) % 26) for c in 'xyz'))
- What is printed? python import math print(len(str(math.factorial(200))))
- What is printed? python import bisect print(bisect.bisectleft([1, 1, 1], 1), bisect.bisectright([1, 1, 1], 1))
- What is printed? python print(0.1 0.1 == 0.01, round(0.1 0.1, 2) == 0.01)
- What is printed? python print(list(filter(None, [0, 1, '', 'a', None, [], [0]])))
- What is printed? python x = 5 print(x.add(3), (5).bitlength(), 5 .real)