Paired Programming Activity
IPO Problems
Activities
I would like you to attempt to complete four small Python scripts working with your partner.
Please try to make your program output look as much like the example as possible and verify it works with the example input provided. If you have difficulty finding the information or understanding how to approach the problem, you should contact me.
To complete this activity, you will need to create the following scripts:
- IPO 1 Discount Price
- IPO 2 How Far
- IPO 3 Time left to our destination
- IPO 4 Area inside of a racetrack
IPO 1
Discount Price
Brice Tagg wants you to create a program to help her calculate sale prices in her store.
Write a Python script that conforms to the following
- Inputs
- Asks for the original price (of an item)
- Asks for the percentage off
- Print Statements
- Prints the the sales price for the item.
- You should round the price to two decimal places
- Example(s)
- Special Instructions
- You should round the price to two decimal places
- Note that this function will not add decimals if fewer than two are used in the answer (see the second example above).
IPO 2
How Far
Wayne Ningmoon teaches middle school science. He is currently teaching a unit on space exploration. He wants your help calculating where the Voyager 1 spacecraft currently is located.
- Background
- Voyager 1 was launched by NASA on September 15, 1977.
- It is the farthest-traveling Earth-made object.
- It actually left the bounds of our solar system in August of 2012.
- As of April 1, 2022 the spacecraft was located ~14,500,000,000 miles from the sun.
- It is traveling away from the sun at a speed of ~38,027 miles per hour.
- Inputs
- Asks how many days it has been since April 1, 2022
- Print Statements
- Prints the the approximate distance between the sun and Voyager 1 based on the previous information
- Example(s)
- Special Instructions
- The calculations above are estimates. To see the actual distance right now you can visit the Voyager status page on the NASA website.
IPO 3
Time left to our destination
Miles Prower is an over-the-road truck driver. He is interested in figuring out how long it will take him to get to the next exit.
Write a Python script that conforms to the following
- Inputs
- Asks for the current speed
- Asks for the distance to travel
- Print Statements
- Prints how long it will take (in minutes) to get there.
- You should round the time to 1 decimal place
- Example(s)
- Special Instructions
- Remember that MPH tells us how many miles he will travel in 60 minutes
IPO 4
Area inside of a race track
Rusty Fender designs racing tracks. One of the considerations for a race track is how much area is inside of the track for things like the team pits and RV parking. He wants a quick and easy way to calculate the area inside of the track.
Write a Python script that conforms to the following
- Inputs
- Asks the user for the length of the straightaways
- Asks the user for the radius of the two curves
- Print Statements
- Prints the the overall area inside of the track described by those dimensions
- Round to 1 decimal place
- Examples
- Special Instructions
- Think about the dimensions of a track. A perfect racing "oval" is actually a rectangle closed in by two perfect semi-circles on each end:
- For the sake of this program lets define
- For your reference:
- a standard high school running track has straightaways of 84.39 meters and curves with a radius of 36.5 meters (example 1 above)
- Bristol Motor Speedway (one of the smaller NASCAR tracks) has straightaways of 650 feet and two slightly different curves with an average radius of 249 feet (example 2 above).
- Think about the dimensions of a track. A perfect racing "oval" is actually a rectangle closed in by two perfect semi-circles on each end: