Start free

Novice · Formatting · 52 of 264

Score table row

Read a name and a score and print them as one row of a table: the name left-aligned in 10 characters, then the score right-aligned in 5 characters.

Input: a name (at most 10 characters), then the score.

Output: one line, e.g. "Ana          95"

Tip: f"{name:<10}{score:>5}"

Examples

Input
Ana
95
Output
Ana          95
Input
Benjamin
7
Output
Benjamin      7
Input
Li
100
Output
Li          100

One more test checks other inputs when you press Check.

Stuck? The idea behind formatting

An f-string puts values into text: f"{name} is {age}". Inside the braces, a format after a colon controls how the value looks.

:.2f gives two decimal places, :5 makes room for five characters, :>5 lines up to the right, :05 fills with zeros.

price = 3.5
print(f"Total: £{price:.2f}")
print(f"{7:03}")  # 007

Watch for: round() can drop a trailing zero (3.50 becomes 3.5); :.2f always shows two places.

All the formatting exercises
Your code
Opening the code editor…
Python 3.14 in your browser
Output
Run shows what your program prints. Check tests it on every example and the hidden tests.

More formatting exercises