Results for “for”

Showing 181–190 of 202

  1. Challenge

    Signal delay

    …distance even light takes minutes. Work out the delay for today's distance: first in seconds, then as minutes and seconds, then for the round trip. Python lets you write big numbers with underscores…

    Write the code Medium 3 stages division round // %
  2. Challenge

    Tank level

    …display draws each tank as a gauge of 10 segments: one # for every full 10% and a - for the rest. Tank B: [#######---] 73.4% Work out how many full tens the percentage has, then repeat "#" that many…

    Write the code Easy 2 stages percentage division rounding string repetition
  3. Challenge

    API response

    …launch["name"] . Inside an f-string, use single quotes for the key: {launch['name']} . Everything in the response Before relying on an API, developers look at a whole response. After the three lines…

    Write the code Easy 2 stages dictionaries keys items JSON
  4. Challenge

    Flatten nested ifs

    The docking check for the station works, but it has grown into three if statements inside each other, with HOLD written out three times. Every new rule would push the code further to the right…

    Fix the code Medium 2 stages if elif and nested conditions
  5. Challenge

    Launch commit criteria

    …on its own doesn't tell the launch director what to wait for. Before the decision, print one line for every rule that fails: Wind 34 km/h, limit 30 km/h Lightning in the area Launch: HOLD Give each…

    Write the code Easy 2 stages if else and not
  6. Challenge

    Normalise a command

    …abort burn: True replace("_", " ") swaps every underscore for a space. Add it, and one for dashes, to the end of the chain.

    Write the code Easy 3 stages strings strip lower replace
  7. Challenge

    Readings that won't add

    …computer as text, the way most data arrives from files, forms and networks. The code that adds them up looks right, but the total it prints makes no sense. Predict what it prints, find out why, fix…

    Fix the code Easy 3 stages type conversion int float str
  8. Challenge

    Mission elapsed time

    …76.3 The middle line is how Python prints a timedelta . For the hours, divide elapsed.total_seconds() by 3600. Three time zones Ground stations report events in their own clock's time zone: UTC…

    Write the code Medium 2 stages datetime timedelta ISO 8601 time zones
  9. Challenge

    Test the error

    …Leave the function as it is. The hidden tests swap it for a version that doesn't raise at all, and one that raises TypeError instead; your check must fail on both. The message, and what must still…

    Write the code Medium 2 stages testing assert try except