Variables II

Assignment

Create a program that assigns the value 3.1416 to a variable called "pi", then prints "The value of pi is <value of pi>".

Save as "019.py".

Assignment

Write a program that uses two variables a and b with the values 3.56 and 5.67, respectively. Print the sum, the difference, the product, and the quotient of these numbers in the form "The difference of <a> and <b> is <answer>".

Save as "019a.py".

Assignment

Write a program that prompts for the radius of a circle then calculates and outputs the circumference.

Save as "019b.py".

Assignment

Write a program that prompts for time (in minutes) and distance travelled (in kilometres), then outputs the average speed (in km/h).

Save as "019c.py".

Assignment

Write a program that prompts for two numbers, then divides the first by the second. Write the answer in the form "<a> divided by <b> is <answer>."

Save as "019d.py".

Assignment

Rewrite program 019d, but this time use "// instead of the division ("/") operator. Run the program with different numbers to try to understand what is happening. See your instructor if you are not sure.

Enter what you think the purpose of this operator ("//") is in the program header.

Save as "019e.py".

Assignment

Write a program that prompts for your weight in kilograms, then outputs your equivalent weight in pounds.

Save as "019f.py".

Assignment

Write a program that prompts for the length, width, and height of a box. Calculate and output the surface area and the volume.

Save as "019g.py".

Assignment

A piece of cake contains about 225 calories. Jogging one 1 km uses about 100 calories. Write a program that ask how many pieces of cake you have eaten and tells you how far you must jog to burn up the calories.

Save as "019h.py".