Results for “if”

Showing 11–20 of 100

  1. 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
  2. Challenge

    Ground station pick

    …or Malargüe from the longitude under a spacecraft with an if/elif chain of ranges, then accept longitudes from 0 to 360 and reject values that can't be longitudes.

    Write the code Easy 2 stages if elif else ranges
  3. Challenge

    Safe mode

    …name the rule that fired with boolean variables and an if/elif chain.

    Write the code Medium 2 stages if elif or and
  4. Challenge

    Upload router

    …to images, telemetry or rejected by its extension with an if/elif chain and endswith(), then cope with capitals, spaces and more extensions without changing the name that is shown.

    Write the code Easy 2 stages if elif else or
  5. Challenge

    Flag from config text

    …The config says "False". Follow it through bool() and the if . Investigate and modify Investigate. Find out what bool("False") and bool("") give and store the answers, True or False , in the two…

    Fix the code Easy 3 stages bool if else config
  6. 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
  7. 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
  8. 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
  9. 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