Results for “print”

Showing 91–100 of 150

  1. Challenge

    Check every reading

    …Make it check every temperature in temperatures_c and print each one with its level: 398.0 °C: OK 412.5 °C: WARN 455.2 °C: CRITICAL 401.7 °C: WARN 450.0 °C: CRITICAL 399.9 °C: OK Replace the line…

    Write the code Easy 2 stages for loop lists if elif
  2. Challenge

    Count warnings

    …in the log, one per line, and the WARN entries, then print: Entries: 6 Warnings: 3 log.count("WARN") counts how many times the text appears. A multi-line string has a new line character, "\n"…

    Write the code Medium 3 stages strings count multi-line strings logs
  3. Challenge

    Read the traceback

    …after a tidy-up. Python didn't just give up, though: it printed a traceback, a short report of where the program was when it failed. Read it, note what it tells you, and fix the bug exactly where it…

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

    Log analyser

    …":00" . The first error Find the first ERROR entry and print its time, subsystem and message, or No ERROR entries when there are none: First ERROR: 10:14:47 PROP Fuel valve 2 not responding Stop the…

    Write the code Hard 3 stages project logs parsing Counter
  5. Challenge

    Statistics module

    …and median() , add import statistics at the top, and print the same two lines with statistics.mean() and statistics.median() : Mean: 418.8 C Median: 413.8 C The output doesn't change: that is the…

    Fix the code Easy 2 stages statistics mean median stdev
  6. Challenge

    Clear error messages

    …with a message that shows the value, so the calls below it print: 500.0 Refused: burn length can't be negative: -5 s Write raise ValueError(f"burn length can't be negative: {burn_s} s") inside an if…

    Write the code Medium 2 stages errors raise ValueError TypeError
  7. Challenge

    Confirm by name

    …out, and return the refusal when it isn't true. The calls print: ABORT: Cabin pressure falling Abort refused: pass confirm=True With the * in place, abort("Test", True) stops with a TypeError , and so…

    Write the code Medium 2 stages functions keyword-only arguments * safety
  8. Challenge

    Lookup table

    …weighs 342 N A body that isn't in the table still prints the no-data line: GRAVITY_M_S2.get(body) gives None for a missing key, just like the old else . The whole table The table can do what the chain…

    Fix the code Medium 2 stages dictionaries refactoring lookup tables get
  9. Challenge

    Retry the uplink

    …result from the list, attempt 2 the second, and so on. Print each attempt, stop at the first "ok" , then say how it ended: Attempt 1: timeout Attempt 2: no carrier Attempt 3: ok Uplink sent on attempt…

    Write the code Medium 2 stages for loop range break retry