Computer Studies‎ > ‎Python‎ > ‎Python Tutorial‎ > ‎

Constants

Some programming languages allow you to create a "constant", which is like a variable but can never be changed in value. Python does not, so your only choice is to create a variable and then never modify it!

An example may be:

taxRate = 0.14

Assignment

Write a program that initializes a variable HST with the current Ontario value, then prompts for the price of an object on sale, prints the tax, and the total price in a neatly formatted receipt format.

Save as "020.py".

Assignment

Manitoba currently has not adopted the HST tax system that Ontario uses. Investigate the tax rates (RST, GST) used in Manitoba, and write a program that prompts for the price of an object on sale, prints the individual taxes, the total tax, and the total price in a neatly formatted receipt format.

Save as 020a.py.
Comments