Results for “functions”

Showing 31–39 of 39

  1. Challenge

    Prove the fix

    …it stays fixed? Six months from now someone will tidy the function, and log=[] looks so much simpler than the None check. Write the test that proves the fix: it has to pass now and fail on the old…

    Write the code Medium 2 stages testing assert regression tests default values
  2. Challenge

    Test the parser

    Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…

    Write the code Medium 2 stages testing assert parsing None
  3. Challenge

    Test the error

    …with a ValueError . That refusal is part of what the function promises, as much as the arithmetic is, and like the arithmetic it can quietly break. Write the test that keeps it honest. The hidden…

    Write the code Medium 2 stages testing assert try except
  4. Challenge

    Log to a file

    …the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.

    Write the code Easy 2 stages files open with write
  5. Challenge

    Statistics module

    …The check looks for the module and makes sure your own functions are gone. Spread, and too little data Now there are three passes. For each, print the mean, the median and the standard deviation…

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

    Readings summary

    …the summary. Summarise the readings with Python's built-in functions, then make sure the summary survives a pass with no readings at all. Min, max, mean Print the lowest and the highest reading, and…

    Write the code Easy 2 stages lists min max sum
  7. Challenge

    Round or cut?

    …see your prediction next to what Python printed. The two functions handle the decimals differently. What does each one give for 1499.7? Investigate and modify Investigate. Store what int(2.9) gives in…

    Write the code Medium 3 stages int round rounding type conversion
  8. Challenge

    Launch schedule digest

    …(ISRO) 2026-11-20 18:45 UTC Polaris Cargo 4 (NASA) A small function such as window(launch) , returning the parsed datetime, works for the comparison and as the key for sorted() . strftime("%Y-%m-%d…

    Write the code Medium 3 stages project json datetime timedelta