I been asked to write a program that displays the dimensions of a letter-size (8.5 x 11 inches) sheet of paper in millimetres. There are 25.4 millimetres per inch. I need to use constants and comments in my program. This is what I come up with:
#This is a program that displays dimensions of a letter-size
#sheet of paper in millimeters.
# Conversion from inches to millimeters.
# w = 8.5 inches * 25.4mm/inch = 215.9 mm
# h = 11 inches *25.4mm/inch = 279.4 mm
# Define constants
WIDTH_IN_MILLIMETERS = 215.9
HEIGHT_IN_MILLIMETERS = 279.4#Compute and print dimmensions of a letter-size sheet of paper in millimeters.
dimLetterSize = WIDTH_IN_MILLIMETERS * HEIGHT_IN_MILLIMETERSprint("The dimentions of a letter-size sheet of paper in millimeters: %6d" % dimLetterSize)