ProgrammingModerateTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print([x for x in range(20) if x % 3 == 0 and x % 4 == 0])
- A. [0, 12]
- B. [0, 3, 6, 9, 12, 15, 18]
- C. [12]
- D. [0, 4, 8, 12, 16]
Correct answer: A. [0, 12]
A number divisible by both 3 and 4 is divisible by 12. Within 0 to 19 these are 0 and 12.
More Python Programming questions
- What is printed? python print(len({(i, j) for i in range(3) for j in range(3) if i <= j}))
- What is printed? python print(sum(1 for c in 'Hello World' if c.isupper()), 'Hello World'.count('o'))
- What is printed? python print(float('1e400'), -float('1e400'))
- What is printed? python print(str(1e16), str(1e15), str(123456789.0))
- What is printed? python print(0.1 3, 1.1 1.1)
- What is printed? python print(5 / 2, 5 // 2, -5 / 2, -5 // 2)