Challenge
Logging instead of print
…from the text, since the format adds it. With the level set to INFO , the debug lines disappear: INFO TANK-1 ok: 78.3% WARNING TANK-2 is low: 12.4% ERROR TANK-3 is empty INFO Tank check complete Leave…
Showing 31–40 of 47
Challenge
…from the text, since the format adds it. With the level set to INFO , the debug lines disappear: INFO TANK-1 ok: 78.3% WARNING TANK-2 is low: 12.4% ERROR TANK-3 is empty INFO Tank check complete Leave…
Challenge
status_light() returns None for Scrub because that branch sets a variable but never returns it. Predict the last line, find which statuses give None, make every path return, then write a function…
Challenge
…second_error . Modify. Fix both errors. With oxygen_status set to LOW it must print: Switch to the backup oxygen supply Make: Undocking check Write the check that runs before undocking. If the hatch…
Challenge
…Make: Four levels The radiation monitor needs four levels, set by the flight surgeon: below 30 NORMAL from 30, below 100 ELEVATED from 100, below 1000 HIGH from 1000 SHELTER Print the level for the…
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…
Example
Adding, changing and removing dictionary elements in Python.
Article Python Fundamentals
…and services Data Science : Analyze complex data sets AI/Machine Learning : Create intelligent systems Automation : Streamline business processes Web Development : Create dynamic websites Scientific…
Challenge
…The readings arrive as text, so leave the two lines that set them as they are. Convert them where you add them up, with int() , so the program prints: 200 Make: Decimal readings The cabin pressure…
Challenge
…With no errors in the log: No errors Checked 6 of 6 lines Set checked = 0 and found = False before the loop. Inside it, add 1 to checked for every line, and set found = True just before the break .
Challenge
…print once at the end: ENG-2: 412.5 °C, WARN Each branch sets level , and the single print() after the chain uses it.