Omniadisce

Computational physics 3.2: Return or print?

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 25 min

By the end you can

  • Write powers with **
  • Write s = ½gt² as a function and call it in a loop
  • Tell return from print, and say what None is
  • Fix a function that prints instead of returning
  • Use what a function gives back in a sum

Who it is for: Anyone who has done lesson 3.1, and physics lesson 2.7 (free fall).

The steps

  1. Free fall as a function
  2. Two stars
  3. Write the formula
  4. One function, many calls
  5. A table of falls
  6. Print instead of return
  7. return gives back; print only shows
  8. Which body can be added up?
  9. The None error
  10. Fix it: return, not print
  11. How far in between?
  12. Return or print?

Discussion 0 comments

Log in to join the discussion.

× Enlarged view