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: Rectangle

  • Write a script called basic2_rectangle_input.py that will ask for the sides of a rectangle and print out the area.
  • Provide error messages if either of the sides is negative.
python rect.py
Side: 3
Side: 4
The area is 12