Results for “negative slice”

6 results

  1. Challenge

    Last five readings

    Show only the five most recent CO2 readings with the slice [-5:], as a dashboard does, then add a new reading and print how much the level changed across the window.

    Write the code Easy 2 stages lists slicing negative slice append
  2. Challenge

    Off-by-one slice

    A slice meant to take the number from the container tag CG-0042 gives -004. Predict it, work out where indexes start and where a slice ends, fix it, then slice a sample label yourself.

    Fix the code Easy 3 stages strings slicing indexing off-by-one
  3. Article Python Fundamentals

    Python Functions for Beginners

    …doing any maths. Stretch goal: add a function that rejects negative numbers and asks again. 2. Countdown Write countdown(start) that prints the numbers from start down to 1, followed by "Liftoff!"…