Team Activity - Areas of Shapes
Team Activity Overview
For this assignment you need to meet with your team and work together to help each person on the team understand the concepts.
Keep in mind that the goal of this activity is to work together and teach and learn from one another. The vision is to help everyone understand the material rather than moving through it as quickly as you can.
Overview
Python can be used to calculate values for data analysis and complex mathematical and scientific problems. In this activity, you will practice using variables and expressions for straight-forward math calculations. The purpose of the assignment is to help you become more comfortable using variables to accomplish a problem, not to focus on the actual math at hand.
Assignment
Start by completing the core requirements. Then, when that part is complete, if you have time, see if you can complete some of the stretch challenges as well.
Core Requirements
Write a program to compute the areas of three different shapes. Prompt for the necessary information, then compute and display the area, as follows:
Make sure that your program can appropriately handle decimal values as well as whole numbers.
Square—The area is the length of a side squared.
Rectangle—The area is the length multiplied by the width.
Circle—The area is Pi (you can use 3.14) multiplied by the radius squared.
An example run of the program might look something like the following:
What is the length of a side of the square? 5
The area of the square is: 25.0
What is the length of rectangle? 6
What is the width of the rectangle? 7
The area of the rectangle is: 42.0
What is the radius of the circle? 5
The area of the circle is: 78.5
Another run could be the following:
What is the length of a side of the square? 3.5
The area of the square is: 12.25
What is the length of rectangle? 6
What is the width of the rectangle? 7.5
The area of the rectangle is: 45.0
What is the radius of the circle? 8.2
The area of the circle is: 211.1336
Stretch Challenge
Once you have finished the core requirements, you are welcome to move on to the stretch challenges. These can be more difficult and may require finding solutions that weren't directly covered in the reading. These aren't specifically required for the assignment, but are a great chance to dive deeper into the concepts of the lesson.
The stretch challenges for this activity are:
Instead of using 3.14 for your value of Pi, see if you can find and use the built-in value of Pi included in the python "math" module. Hint, you might try searching on the internet for something like, "python how to get the value of pi."
Prompt the user for a single length value, then compute and display the areas of a square with that length of side, a circle with that radius, and then the volumes of a cube with that side and a sphere with that radius, all from the same value from the user.
For each of the three areas in the core requirements, change the prompt for the user to ask for the value in centimeters. Then, display the resulting area in both square centimeters and square meters. Keep in mind that a centimeter is 1/100 of a meter, and a square centimeter is 1/10,000 of a square meter.
Sample Solution
When your program is finished, please view the sample solution for this program to compare it to your approach.
You should work to complete this team activity for the one hour period first, without looking at the sample solution. However, if you have worked on it for at least an hour and are still having problems, you may feel free to use the sample solution to help you finish your program.
Submission
When you have finished your team meeting, you are welcome to continue working on your own. Feel free to include that additional work when you report on your progress in Canvas.
When you are finished:
- Return to Canvas to take the quiz.
Up Next
- Project Milestone: Meal Price Calculator
Other Links:
- Return to: Week Overview | Course Home