Omniadisce

Computational physics 1.4: Comments and labels

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.

11 steps ยท about 20 min

By the end you can

  • Write a comment with #, and say what Python does with it
  • Note a quantity's unit in a comment
  • Switch a line off and on with #
  • Print a label and a number together, separated by a comma

Who it is for: Anyone who has done lesson 1.3 (variables and formulas).

The steps

  1. A first guess
  2. Comments: notes for people
  3. Which line stores the number?
  4. Switch a line on
  5. A label and a number
  6. Quotes or not?
  7. Add the number to the label
  8. A unit after the number
  9. Your turn: a falling stone
  10. A number and its unit
  11. In your own words

Discussion 0 comments

Log in to join the discussion.

× Enlarged view