Results for “key”

Showing 11–20 of 32

  1. Challenge

    Mass by category

    …(41%) crew: 3.4 kg (3%) spares: 2.4 kg (2%) sorted(totals, key=totals.get, reverse=True) gives the categories ordered by their totals. sum(totals.values()) is the whole load.

    Write the code Medium 2 stages dictionaries grouping get sorted
  2. Challenge

    API response

    …Lumen-3 Provider: JAXA Status: Go Read a value with its key in square brackets: launch["name"] . Inside an f-string, use single quotes for the key: {launch['name']} . Everything in the response Before…

    Write the code Easy 2 stages dictionaries keys items JSON
  3. Challenge

    Read the traceback

    …in average_kelvin File "script.py", line 10, in to_kelvin KeyError: 'temperature_c' Read it from the bottom: the last line is the error, and the File line just above it is where it happened. Fill in…

    Fix the code Easy 2 stages errors traceback KeyError TypeError
  4. Challenge

    Unit converter

    Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…

    Write the code Medium 2 stages project dictionaries tuples as keys functions
  5. Challenge

    JSON out

    …keep the station's Polish letters readable and sort the keys so the files compare easily.

    Write the code Easy 2 stages json json.dumps modules import
  6. Challenge

    Config loader

    …hand. Last week someone typed "256" in quotes, misspelt a key and set twelve retries, and the module started with the wrong settings without a word. Write the loader that fills in what is missing…

    Write the code Hard 3 stages project json configuration validation
  7. Challenge

    Counter

    …counts.get() with collections.Counter, which starts every key at 0, then list the levels from most to least common with most_common().

    Fix the code Easy 2 stages collections Counter most_common dictionaries