Challenge
Legacy script
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Showing 31–40 of 75
Challenge
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Challenge
Replace all but the last four characters of an access code with * using len(), slicing and string repetition, then find a code inside a log line and mask it there before the line is saved.
Example
Return statement returns a value from function. Function can perform calculations and give result.
Example
While loop executes as long as condition is true. Controlling iteration with condition.
Challenge
…it goes wrong: Python takes the first inner quote as the end of the text. Quotes inside quotes Run the script: Python stops with a SyntaxError , because the double quote before status ends the text…
Challenge
…reason for a refusal now sits four levels deep, at the far end of an else whose if is off the top of the screen. Flatten the function without changing a single answer, then add the next rule the…
Challenge
…The list is oldest first, so the most recent are at the end. A negative start counts from the end, as with strings. The window moves A new reading has arrived. Add new_reading = 772 under the list…
Challenge
…T , at index 11, and is 8 characters long. In text[start:end] , the character at end isn't included. The way we write it In Poland and much of Europe, dates are written day first, with dots…
Challenge
…show: Command: [launch] strip() removes spaces from both ends and lower() turns capitals into small letters. You can call one straight after the other: typed.strip().lower() . Does it match? Now check…
Challenge
…Because the names are all different lengths, the states end up scattered across the screen, and a HOLD is easy to miss. Line the states up in a column. Format specs can give each value a fixed width…