ProgrammingHardTCS NQT · Infosys pattern
What is printed?
What is printed?
print(f"{10 / 3:.3f}")
print(f"{10 // 3}")
print(f"{2 ** 10:,}")- A. 3.333 3 1,024
- B. 3.3 3 1024
- C. 3.333 3.33 1,024
- D. 3.330 3 1,024
Correct answer: A. 3.333 3 1,024
10/3 to 3 decimal places rounds to 3.333. 10//3 is plain integer floor division, 3. 2**10 is 1024, formatted with a thousands separator as 1,024.
More Python Programming questions
- What is printed? python x = [] print(bool(x), bool([0]), bool({}), bool({0: 0}))
- What is printed? python import itertools print(list(itertools.islice(itertools.count(5, 2), 4)))
- What is printed? python import itertools print(list(itertools.chain([1, 2], [3, 4]))) print(list(itertools.chain.fromiterable([[1, 2], [3…
- What is printed? python import itertools print(list(itertools.combinations([1, 2, 3, 4], 2)))
- What is printed? python import itertools print(list(itertools.accumulate([1, 2, 3, 4]))) print(list(itertools.accumulate([1, 2, 3, 4]…
- What is printed? python print(list(zip([1, 2, 3], [4, 5], [6, 7, 8, 9]))) from itertools import ziplongest print(list(ziplongest([1, 2…