Challenge
Crew roster
…member and the crew size from a list with [0], [-1] and len(), then add the second in command and the whole roster joined into one line.
Showing 1–10 of 45
Challenge
…member and the crew size from a list with [0], [-1] and len(), then add the second in command and the whole roster joined into one line.
Challenge
…an IndexError. Predict it, work out the valid indexes with len(), fix it with [-1], then print the first, middle and last readings for any length.
Challenge
…engine readings with min(), max() and a mean from sum() / len(), then add the spread and make the summary cope with an empty list instead of crashing.
Challenge
…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.
Challenge
…quietly returns negative fuel for a negative burn length. Make it raise ValueError with a message that shows the bad value, then raise TypeError, checked first, when the length isn't a number at all.
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
Ask for an engine burn length with input(), turn it into a number with float() and work out the propellant it uses, then read the tank level too and show what the burn leaves.
Challenge
…wrong error fails it, then pin down the message and the lengths that must still work.
Challenge
…('burn', 0.5) REJECTED "burn": burn needs one value: the length in seconds REJECTED "burn ten": burn length must be a number: ten REJECTED "burn -4": burn length must be positive: -4 REJECTED "dance"…
Challenge
…list of units and warn when the lists don't have the same length, since zip() quietly stops at the shortest.