Results for “for”

Showing 1–10 of 136

  1. Challenge

    Fuel for a burn

    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.

    Write the code Easy 2 stages input float type conversion multiplication
  2. Challenge

    Log line format

    …prints 12 , but {seconds} prints 5 , not 05 . Add a format spec after a colon: {seconds:02} means "at least 2 characters wide, filled with zeros".

    Write the code Easy 2 stages f-strings print logs formatting
  3. Challenge

    Log formatter function

    Move the mission log's f-string into format_log(t, level, msg), a function that returns the line instead of printing it, then fix the alignment of every log line with one change inside the function.

    Fix the code Easy 2 stages functions def return refactoring
  4. Challenge

    One orbit short

    …is ten orbits long, and the flight log should have a line for each one. The log always ends one orbit early, and the last orbit, the one that matters for the landing, is never in it. Predict the last…

    Fix the code Easy 3 stages for loop range off-by-one step
  5. Challenge

    Filter the log

    …line.split()[1] . LEVELS.index(level) gives its rank, 0 for INFO up to 2 for ERROR, so compare the ranks.

    Write the code Medium 2 stages for loop lists append filtering
  6. Challenge

    First error

    Scan the mission log for the first ERROR entry, print its line number with enumerate() and stop there with break, then report how many lines were checked, or that there were no errors at all.

    Write the code Easy 2 stages for loop break enumerate flags
  7. Challenge

    Check every reading

    Extend the OK/WARN/CRITICAL check from Alert level so a for loop runs it over every temperature in a list, then count the WARN and CRITICAL readings for a summary line.

    Write the code Easy 2 stages for loop lists if elif
  8. Challenge

    Daily mission report

    Turn the day's subsystem status into a fixed-width report for the shift handover, with aligned columns and a totals line, then save the same data as a CSV file with csv.DictWriter for the spreadsheet…

    Write the code Medium 2 stages project formatting f-strings alignment