Python Lesson 2 – Calculations and Variables
May 2, 2014
[This is part of a series of posts on learning and teaching Python with my 10-year old son. Read the back story.]
Go back to Python Lesson 1 – Hello World
Lesson 2 shows how you can use Python for mathematical calculations, with and without variables.
Basic symbols are introduced.
Order of operations is discussed: Multiplication and Division are performed before Addition and Subtraction (unless parentheses are used).
Variables are introduced as a “place to store information such as numbers, text, lists of numbers or text and so on” and then a series of examples is provided to allow your kid to play around, using python as a calculator. You can follow the script in the book or you can just make up stuff using variables and symbols to compute.
My son enjoyed making up silly variable names and assigning numbers then using them in calculations.
Watch this video to see and hear him in action. You may need to change the settings on your video player to get a clear look at the console screen and the Python code being typed. Set to 720p HD for the clearest picture. If someone is a YouTube or Camtasia guru maybe you can tell me how to make this a default.
[youtube id=”http://www.youtube.com/watch?v=k_ChjuahxzU” width=”600″ height=”350″]