Results for “collections”

8 results

  1. Challenge

    Counter

    …per level": replace the dict and 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
  2. Challenge

    Log analyser

    Turn the launch-day mission log into answers: parse each line into a dict, count the entries per level and per hour, find the first ERROR, then rank the subsystems by how many warnings they raised.

    Write the code Hard 3 stages project logs parsing Counter
  3. Article Python Fundamentals

    Variables and data types in Python

    …engines_active = False Complex Data Types Lists Ordered collections of items, great for storing sequences of data: planet_names = ["Mercury", "Venus", "Earth", "Mars"] temperatures = [167, 464, 15…

  4. Article Mini projects

    Medical dispenser - Don’t trust the user

    …need the secure approach shown later. import time from collections import deque class MonotonicMedicationDispenser: """Uses monotonic time - can't be tricked by system clock changes Note: This only…

  5. Article Mini projects

    Calculate your weight on different planets in Python

    …in m/s². What's a Dictionary? In Python, a dictionary is a collection of key-value pairs. It's like a real-world dictionary where you have a word (the key) and its definition (the value). In our…