Results for “if”

Showing 21–30 of 63

  1. Challenge

    Copy-pasted blocks

    …with for name, level in tanks: and keep one copy of the if / else , with name in place of the letter. A fourth tank A fourth tank has been fitted. Add tank_d = 9.75 under tank_c and one more pair to…

    Fix the code Medium 2 stages refactoring for loop tuples lists
  2. Challenge

    Clear error messages

    …length can't be negative: {burn_s} s") inside an if , before the calculation. A burn of 0 seconds is allowed. Raise TypeError A burn length read from a file arrives as the text "40" , and the function…

    Write the code Medium 2 stages errors raise ValueError TypeError
  3. Challenge

    Line to record

    …every record, print only the records of the wanted sensor. If there are none, say so: Records: 4 ENG-2 at 09:30:05: 412.5 C ENG-2 at 09:30:10: 415.0 C With wanted = "GYRO-X" , the last line is No…

    Write the code Easy 2 stages dictionaries lists parsing records
  4. Challenge

    Retry the uplink

    …3 Start delay_s = 2 before the loop. After a failure, if attempt < MAX_ATTEMPTS , print the wait and double delay_s . (The simulator only prints the wait; real code would call time.sleep(delay_s) .)

    Write the code Medium 2 stages for loop range break retry
  5. Challenge

    Airlock permissions

    …that the crew member holds every permission in needed . If not, print what is missing, sorted: Kowalska can't depressurise the airlock: missing eva_certified needed <= granted is True when every item…

    Write the code Medium 2 stages sets subset difference permissions
  6. Challenge

    Countdown with holds

    …and end the countdown there, even at a second with a hold. If it reaches the end, print Liftoff! : T-10 T-9 T-8 T-7 HOLD at T-7 T-6 T-5 T-4 T-3 HOLD at T-3 T-2 T-1 T-0 Liftoff! With scrub_at = 4 , the…

    Write the code Easy 2 stages for loop range negative step in
  7. Challenge

    Never-ending wait

    …. Then work out how many "waiting" lines there would be if second went up by 1 each time, and store it in waiting_lines . Remove any lines you added before you check. Modify. Make the loop move on to…

    Fix the code Easy 3 stages while loop infinite loop counter and
  8. 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…

    Fix the code Hard 2 stages project refactoring functions testing
  9. Challenge

    Undo and history

    Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.

    Write the code Hard 2 stages project lists stack append