Challenge
Safe number input
The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…
Showing 11–20 of 55
Challenge
The burn length is typed in by hand, and a typo stops the program with a ValueError. Catch it with try and except, keep asking until the input is a number, then also turn away zero and negative…
Challenge
…count the entries per level and per hour, find the first ERROR, then rank the subsystems by how many warnings they raised.
Challenge
…mission log and build a new list holding only the WARN and ERROR entries with append(), then let a minimum level decide what counts, the way logging tools filter by severity.
Challenge
Check whether a mission log line contains ERROR with in, find where it starts with find(), including the -1 it gives when there is nothing to find, then slice out the error message.
Article Mini projects
…data with a graphical interface, database operations, and error handling.
Challenge
…, logging.info() , logging.warning() or logging.error() , and drop the level from the text, since the format adds it. With the level set to INFO , the debug lines disappear: INFO TANK-1 ok: 78.3%…
Challenge
Count the mission log's entries per level, INFO, WARN and ERROR, in a dict of counters, then count any level at all with get() when DEBUG lines turn up, and print the levels in alphabetical order.
Challenge
…it joins text and a number with +. Predict it, read the error, fix it with str(), then build a docking status line.
Challenge
Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…
Challenge
…launch day, the first launch stopped the program with an error nobody had seen before. Predict what happens, find out why, then fix it in a way that keeps the function independent of the rest of the…