Write a programExercise 3/4Elementary20 XP

The warmest and the coldest town

Task

The program reads the number of towns n and then n lines of town temperature (the town name is one word, the temperature a whole number). Store the data as a list of pairs (town, temperature) and print the warmest and the coldest town:

Najteplejšie: Košice (31)
Najchladnejšie: Poprad (24)

If several towns share a temperature, print the one entered first.

Examples

  • Input

    3
    Bratislava 28
    Košice 31
    Poprad 24

    Expected output

    Najteplejšie: Košice (31)
    Najchladnejšie: Poprad (24)

After you submit, 3 hidden tests will also check your solution: one town, equal temperatures, temperatures below zero.

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.