01 Prove Milestone: Review Python
Purpose
Prove that you can write a Python program that gets input from a user, performs arithmetic, and displays results for the user to see.
Problem Statement
The size of a car tire in the United States is represented with three numbers like this: 205/60R15. The first number is the width of the tire in millimeters. The second number is the aspect ratio. The third number is the diameter in inches of the wheel that the tire fits. The volume of space inside a tire can be approximated with this formula:
- v is the volume in liters,
- π is the constant PI, which is the ratio of the circumference of a circle divided by its diameter (use
math.pi
), - w is the width of the tire in millimeters,
- a is the aspect ratio of the tire, and
- d is the diameter of the wheel in inches.
If you’re curious about how the above formula was derived, you can read the tire volume formula derivation.
Assignment
Write a Python program named tire_volume.py
that
reads from the keyboard the three numbers for a tire and computes
and outputs the volume of space inside that tire.
tire_volume.py
. If you name your program something
else, it will be harder for the graders to score your submitted
assignment.Help
If you’re having trouble completing this assignment, reading related online documentation, using a generative AI as a tutor, or working with a human tutor will help you complete it.
Helpful Documentation
- The preparation content for this lesson explains how to write code to do the following:
- Convert user input from a string to a number
- Display results for the user to see
- The Python
math
module contains mathematical constants and functions, includingmath.pi
, and is described in the Math Module Reference. - The video titled Writing a Small Python Program (10 minutes), shows a BYU-Idaho faculty member solving a problem that is similar to this prove assignment.
Help from an AI Tutor
You could use a generative AI as a tutor to help you write and troubleshoot your program. Bro. Lee Barney created a custom Chat GPT named Pythonista that is fine-tuned to focus on Python functions, loops, if statements, and related programming concepts. If your program is generating an error, ask Pythonista a question like this:
I'm writing a Python program that computes the approximate volume of air in a tire. When I run my program, it causes the following error. Please suggest some mistakes that might cause this error.
(Copy and paste the error message here.)
You could also ask Pythonista a question about one of your functions, like this:
I wrote the following Python function that is supposed to (type a short description here). However, the function isn't (type what it's not doing correctly here). Please help me fix this function.
(Copy and paste your Python function here.)
Help from a Human Tutor
As a BYU-Idaho campus or online student you can get help from a tutor to complete your CSE 111 assignments. Each tutor is a current BYU-Idaho student employed by BYU-Idaho. Meeting with a tutor is free. It will not cost you any money to meet with a tutor. To get help from a tutor, you simply make an appointment and then meet with the tutor. Campus students meet with tutors in the tutoring center. Online students meet with tutors in Zoom. To make an appointment, follow the instructions in the course tutoring guide.
Testing Procedure
Verify that your program works correctly by following each step in this testing procedure:
- Run your program and enter the inputs shown below. Ensure that your program’s output matches the output below.
> python tire_volume.py Enter the width of the tire in mm (ex 205): 185 Enter the aspect ratio of the tire (ex 60): 50 Enter the diameter of the wheel in inches (ex 15): 14 The approximate volume is 24.09 liters > python tire_volume.py Enter the width of the tire in mm (ex 205): 205 Enter the aspect ratio of the tire (ex 60): 60 Enter the diameter of the wheel in inches (ex 15): 15 The approximate volume is 39.92 liters
Ponder
During this assignment, you wrote a Python program that gets input from a user, uses variables, performs arithmetic, and displays results for the user to see. Because you should have learned how to write this type of program in CSE 110, this assignment should have been fairly easy for you. If this assignment was difficult for you, you should review the concepts from CSE 110 and the programs that you wrote in that course.
Submission
On or before the due date, return to I‑Learn and report your progress on this milestone.