ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print(f'{7:03d}|{-7:d}|')- A. 007|-7|
- B. 010|-7|
- C. 007|-07|
- D. 7|-7|
Correct answer: A. 007|-7|
The 03d spec zero-pads the integer to width three, and a negative value keeps its minus sign in the output.
More Python Programming questions
- What is printed? python x = 7 print(f'{x=}', f'{x 2 = }', f'{"a"!r:>4}')
- What is printed? python import keyword print(keyword.iskeyword('match'), keyword.issoftkeyword('match'), keyword.iskeyword('None')…
- What is printed? python print({'a': 1} | {'a': 2, 'b': 3}, {'a': 1} | {}, dict(a=1) == {'a': 1})
- What is printed? python print(format(1234567.891, ',.2f'), format(0.000123, 'e'), format(12, '>5'), format(3, '03'))
- What is printed? python print((1 + 2j) (3 - 1j), abs(3 + 4j), (1 + 2j).conjugate())
- What is printed? python print(list(zip([1, 2, 3], 'ab')), list(zip('ab', [1, 2, 3], [True])), len(list(zip())))