Results for “if”

Showing 11–20 of 63

  1. Challenge

    Missing reading

    …into the else , indented by four more spaces. Don't use if not temperature_c : 0 °C is a real reading. An empty field Readings now come from the telemetry feed, and a missing value shows up as an…

    Write the code Medium 2 stages if else None is None
  2. Challenge

    Unreachable branch

    A vibration check reports WARN for a reading of 63 because its elif conditions are in the wrong order, so CRITICAL can never run. Predict it, find the dead branch, fix the order, then write a…

    Fix the code Easy 3 stages if elif order of conditions debugging
  3. Challenge

    Test the error

    …Expect the ValueError Write a check that passes only if fuel_needed(-5) raises ValueError : call it in try , set a variable to True in except ValueError: , and assert it after. Then print: All checks…

    Write the code Medium 2 stages testing assert try except
  4. Challenge

    Guard clauses

    Rewrite the four nested ifs in can_dock() as guard clauses that return a reason as soon as a check fails, keeping every answer the same, then add a new docking rule as one more guard with a default…

    Fix the code Medium 2 stages functions return guard clauses refactoring
  5. Challenge

    Approved payloads

    …list Strip the spaces and make it upper case, then use if with in . For " pl-117 " it prints the first line.

    Write the code Easy 2 stages lists in membership if
  6. Challenge

    Lookup table

    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.

    Fix the code Medium 2 stages dictionaries refactoring lookup tables get
  7. Challenge

    Numbered checklist

    Print a pre-flight checklist numbered from 1 with enumerate(list, start=1), then tick off the items the crew has already done with [x] and leave the rest as [ ].

    Write the code Easy 2 stages for loop enumerate start lists
  8. Challenge

    Flight software review

    …0.0-450.0 Look at the decision line it prints after that. If it seems wrong to you, you are right: that is the fifth bug, for stage 2. This stage checks the lines above. Make it right ENG-2 is over…

    Fix the code Hard 2 stages project debugging SyntaxError TypeError
  9. Challenge

    Test the pipeline

    …whoever changes the pipeline next must find out at once if something broke. Write them. The hidden tests plant three bugs, one at a time, and your tests must catch every one. Test parse_row() Write…

    Write the code Hard 2 stages project testing assert try