Omniadisce

Computational physics 3.4: Lists

Lesson Beginner

Join free to take this lesson

Anyone can look around, but taking a lesson needs a free account. With one, your answers are checked step by step and your progress is saved, so you can stop and pick up where you left off on any device.

13 steps ยท about 20 min

By the end you can

  • Make a list of readings with square brackets
  • Pick out a reading by its index, counting from 0
  • Use list[-1] for the last reading and len for how many
  • Add a reading to the end with append
  • Read an IndexError

Who it is for: Anyone who has done lessons 3.1 to 3.3, and physics lesson 1.5 (repeated measurements).

The steps

  1. A first guess
  2. A list
  3. Counting from 0
  4. Run it
  5. The third reading
  6. Pick a reading
  7. The last one, and how many
  8. The last reading
  9. How many readings?
  10. Out of range
  11. Adding a reading: append
  12. A new timing
  13. Counting from 0

Discussion 0 comments

Log in to join the discussion.

× Enlarged view