Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Calculations

  • Extend the examples/basics/rectangle_basic.py file from the earlier example to print both the area and the circumference of the rectangle.
  • Write a script called basic_circle.py that has a variable holding the radius of a circle and prints out the area of the circle and the circumference of the circle.
  • Write a script called basic_calc.py that has two numbers a and b and prints out the results of a+b, a-b, a*b, a/b