Aligned Columns
Completed
Read a product name and a price. Print the name left-aligned in a 10-character column, followed by the price right-aligned in an 8-character column with 2 decimals.
Input
Line 1: name. Line 2: price (decimal).
Output
One line, e.g. Tea | 12.50 — note the | between the columns.
Example
Input
Tea 12.5
Output
Tea | 12.50
Editor
Python
Hints
{x:<10} pads to 10 characters, aligned left.
{x:>8.2f} right-aligns in 8 characters with 2 decimals.
Solution explanation
Format specs go after a colon: < left, > right, ^ centre, then the width, then the precision and type.
Show solution
name = input()
price = float(input())
print(f"{name:<10}|{price:>8.2f}")