ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(f'{"":>3}|', f'{"x":^3}|', f'{None!s:>6}|')
  1. A. | z | None|
  2. B. | x | None|
  3. C. | x | Nona|
  4. D. | y | None|

Correct answer: B. | x | None|

An empty string right-aligned to three columns is three spaces. The centre spec gives x one space on each side, and !s with width six pads None on the left.

More Python Programming questions

Exams that ask this topic