Challenge
Parser function
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Showing 11–13 of 13
Challenge
Move the feed parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.
Challenge
Replace a nine-branch elif that maps planets and the Moon to surface gravity with a dict and one get() lookup, keeping the output exactly the same, then loop over the dict for a weight table.
Challenge
A cargo calculation uses a, b, x2 and tmp. Predict it, work out what each name holds, rename them so the code explains itself, then write a fuel check with good names.