Question: Python 3.7 You have just graduated and you are job hunting. You have been offered two different jobs, one at Software 4 Us which is
Python 3.7
You have just graduated and you are job hunting. You have been offered two different jobs, one at Software 4 Us which is 25 miles from where you live, and one at Biotech Forever, which is 15 miles from your home. One of your neighbors already works at Software 4 Us and has said you could ride together which would cut the emissions from your car in half. Because you are an ISAT graduate, you want to reduce your commuting CO2 emissions as much as possible.Based on the emissions from your car in a year, which job should you take?
You decide to use your excellent programming skills to write a program to help you and anyone else calculate CO2 emissions in a year based on the distance to work and the miles per gallon efficiency of the vehicle. You want to make it more flexible also by allowing for part time work, or ride sharing, so also ask for the number of days worked per week. Your program should ask for these 3 things, and then calculate the emissions for the entire year. Use a global constant to hold the number of pounds emission per gallon of gasoline (no other variables should be global). Be sure to use all the correct comments for your program. Follow the steps used to develop the Python program:
1.Create a function called yearly_miles_driven that receives variables that hold the distance to work and the days worked each week. This function should calculate and return the miles driven per year.
2.Create a function called gallons_used_per_year that receives the miles driven each year and the miles per gallon for the vehicle. This function should calculate and return the gallons of gas used each year.
3.Create a function called emission_per_year that receives the gallons of gas used per year and returns the pounds of CO2 emitted each year.
4.Create a main() function that is used to gather user input, call your functions and display properly formatted output (i.e. the output of your program should be on two lines in a simple table format (see example table below to check correctness of your program)
.-->CO2 emissions from a gallon of gasoline = 2,421 grams x 0.99 x (44/12) = 8,788grams = 8.8 kg/gallon = 19.4 pounds/gallon
--> CO2 emissions from a gallon of diesel = 2,778 grams x 0.99 x (44/12) = 10,084grams = 10.1 kg/gallon = 22.2 pounds/gallon
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
