Home » Chapter 2 : Programming Basics
Simple Math
Now that we have learned about variables, user input, and basic arithmetic operators, let's work through some example problems. If you do not know how to calculate the requested values, do not look at the solution tabs, instead use outside sources to research how to perform that calculation. In real-world scenarios, the solution is not provided so we must research to learn the domain.
Average: Write a Python program that calculates and prints the average of the following numbers.
23, 57, 43, 92, 54, 34, 45, 99
Perimeter of a Triangle: Write a Python program that calculates the perimeter of the triangle shown below. Use variables for each component of the formula and name them with understandable names based on their parts of the formula. The output should be in the form of an informative sentence.
Area of a Circle: Write a Python program that calculates and prints the area of the circle given below. Use variables for each component in the formula and name them with understandable names based on their parts of the formula. The output should be in the form of an informative sentence.
Area of a Circle #2: Write a Python program that prompts the user for the radius of a circle, then calculates and prints the area of the circle based on that radius. The user prompt should be descriptive for the user. The output should be in the form of an informative sentence.
Paint Estimate: Write a Python program that calculates an estimate of the number of gallons of paint needed to paint the room shown in the image below. Your estimate should be enough paint to cover the interior walls with 1 coat of paint, excluding the space consumed by the door, windows, and fireplace opening. The output should be in the form of an informative sentence.