Results for “lists”

Showing 81–90 of 92

  1. Challenge

    Log to a file

    The mission log has lived in a Python list, which disappears the moment the program ends. Tomorrow's shift wants to read what happened today, and the flight director wants a file she can send to the…

    Write the code Easy 2 stages files open with write
  2. Article Python Fundamentals

    Python Functions for Beginners

    …five, calls get hard to read and easy to get wrong. A long list of parameters is often a sign that the function is trying to do too many jobs. When you really do need several, keyword arguments make…

  3. Challenge

    Alert deduplicator

    …COMMS Signal weak (x2) Keep the groups as dicts in a list, groups , with first , last , source , message and count , and a dict from (source, message) to the newest group for that alert. to_seconds()…

    Write the code Hard 2 stages project dictionaries tuples as keys grouping
  4. Challenge

    Telemetry pipeline

    …valid (the number of readings), rejected and the alerts list, written with json.dump() , indent=2 and ensure_ascii=False . Then print one last line: Saved summary.json The hidden tests open…

    Write the code Hard 3 stages project csv json files
  5. Challenge

    Airlock permissions

    …Check one action for one crew member, then the whole list of airlock actions. One action Check that the crew member holds every permission in needed . If not, print what is missing, sorted: Kowalska…

    Write the code Medium 2 stages sets subset difference permissions
  6. Challenge

    Never-ending wait

    …reach 60 dB, and the loop would run past the end of the list. Wait while there are readings left and the strength is below LOCK_DB , then print where the signal locked, or that it never did: No lock…

    Fix the code Easy 3 stages while loop infinite loop counter and
  7. Challenge

    Parse the whole feed

    …CABIN: 101.2 kPa ENG-2: 415.0 C feed.splitlines() gives a list with one string per line. Inside the loop, line.split(",") gives the four fields, as in "Parse a telemetry line". Named fields and the…

    Write the code Easy 2 stages for loop splitlines split unpacking
  8. Challenge

    Validate a command

    …without the spaces around it but with its capitals, and list the commands that work: Type a command: start, stop or status Unknown command: Launch (use start, stop or status) Keep the typed text in…

    Write the code Easy 2 stages if elif else input
  9. Article Mini projects

    Calculating Escape Velocity in Python

    …CALCULATION WITH NUMPY") print("="*50) names = list(planets.keys()) masses = np.array([planets[p]["mass"] for p in names]) radii = np.array([planets[p]["radius"] for p in names]) # Calculate all…