Omniadisce

Computational physics 2.3: else and elif: choosing a band

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.

12 steps ยท about 20 min

By the end you can

  • Write if ... else ..., where exactly one of two bodies runs
  • Use brackets in a formula inside a body
  • Sort a value into bands with if, elif and else
  • Explain why the order of the questions matters

Who it is for: After lesson 2.2: you can write an if with an indented body.

The steps

  1. One or the other
  2. else: the other way
  3. Run it
  4. Exactly at the limit
  5. A fine that grows
  6. elif: more than two ways
  7. Which band?
  8. Sort a speed
  9. The order matters
  10. Spot the bug
  11. km/h first
  12. In your own words

Discussion 0 comments

Log in to join the discussion.

× Enlarged view