Challenge
Validate a cargo record
…with it, not just the first problem. Write the check as a function that collects the problems, then add a rule for the ID format. Missing fields and negative mass Write validate_cargo(item) , which…
Showing 21–30 of 39
Challenge
…with it, not just the first problem. Write the check as a function that collects the problems, then add a rule for the ID format. Missing fields and negative mass Write validate_cargo(item) , which…
Challenge
…parameters and return value; the tests read both from the function itself.
Challenge
…a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate IDs and check the total load.
Challenge
…with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.
Challenge
…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…
Challenge
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…
Challenge
…Ask Python for it with the platform and sys modules and print it the way python --version does.
Challenge
…Don't run the code yet. Read it and decide what it will print. Write your guess in prediction , at the top, between the quotes. Then run it and compare. Any guess passes this stage: the point is to…
Challenge
…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.
Challenge
…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…