Results for “sort”

Showing 1–10 of 19

  1. Challenge

    sort() returns None

    crew = crew.sort() leaves the roster as None. Predict it, find out what sort() really gives back, fix it by sorting in place, then sort readings from highest to lowest and keep the top three.

    Fix the code Easy 3 stages lists sort None in place
  2. Challenge

    Sort by a field

    Sort launches by date with sorted() and a small function that returns each launch's date, then sort the cargo manifest heaviest first with a key function and reverse=True.

    Write the code Easy 2 stages functions sorted key reverse
  3. Challenge

    Sorted copy

    Print the roster A–Z for a report with sorted() while the sign-up order stays exactly as it was, then sort names like de Vries and van Dijk correctly with key=str.lower.

    Write the code Easy 2 stages lists sorted sort key
  4. Challenge

    Launch schedule digest

    …schedule from JSON, keep the launches still to come, sort them by their window and print a digest line for each with the time left and any hold, then switch the digest to the live clock.

    Write the code Medium 3 stages project json datetime timedelta
  5. Challenge

    Ground pass planner

    …every contact window longer than 8 minutes into one list, sorted by time, then find the longest stretch with no station in contact, counting overlapping passes only once.

    Write the code Medium 2 stages project datetime timedelta sorting
  6. Challenge

    Manifest diff

    …added since yesterday and which were removed, each list sorted: Added: CG-0047, CG-0048 Removed: CG-0043, CG-0045 set(today) - set(yesterday) is what today has that yesterday didn't. A set has no…

    Write the code Easy 2 stages sets difference intersection sorted
  7. Challenge

    Mass by category

    …49.8 kg (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
  8. Challenge

    JSON out

    …then 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
  9. Challenge

    Counter

    …in, then use the one thing a plain dict can't do for you: sort by count. Counter() Import Counter from collections , start with counts = Counter() , and replace the get() line with counts[level] += 1…

    Fix the code Easy 2 stages collections Counter most_common dictionaries