Exercises
Exercise 1: Python Documentation
Use a web browser to go to the Python website. This page contains information about Python and links to Python-related pages, and it gives you the ability to search the Python documentation. For example, if you enter print
in the search window, the first link that appears is the documentation of the print
statement. At this point, not all of it will make sense to you, but it is good to know where it is.
Exercise 2: The help functionality
Start the Python interpreter and type help()
to start the online help utility. Or you can type help('print')
to get information about the print
statement. If this example doesn't work, you may need to install additional Python documentation or set an environment variable; the details depend on your operating system and version of Python.
Exercise 3: A simple calculator
Start the Python interpreter and use it as a calculator. Python's syntax for math operations is almost the same as standard mathematical notation. For example, the symbols +
, -
and /
denote addition, subtraction and division, as you would expect. The symbol for multiplication is *
. If you run a 10 kilometres race in 43 minutes and 30 seconds, what is your average time per mile? What is your average speed in miles per hour? (Hint: there are 1.61 kilometres in a mile).
Last updated