Write a programExercise 4/4Intermediate30 XP

A price table

Task

The program reads three lines. Each contains a product name (one word) and its price (a decimal number) separated by a space. It prints a table: the name aligned left in a width of 10 characters, immediately followed by the price aligned right in a width of 8 characters with two decimal places. The last row has the name SPOLU (total) and the sum of the prices in the same format.

For the input

chlieb 1.89
maslo 2.5
syr 3.149

the program prints

chlieb 1.89
maslo 2.50
syr 3.15
SPOLU 7.54

Examples

  • Input

    chlieb 1.89
    maslo 2.5
    syr 3.149

    Expected output

    chlieb        1.89
    maslo         2.50
    syr           3.15
    SPOLU         7.54

After you submit, 2 hidden tests will also check your solution: a long name and a high price, whole prices.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.