# CS160 Lab 1  Simple Calculations Solved

35.00 \$

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . ` zip` solution files instantly, after Payment

## Description

5/5 - (1 vote)

Write a Python program named toLiters.py that asks the user to enter an amount in quarts and outputs the and outputs the amount in liters. Use the conversion factors that there are four quarts in a gallon and one gallon is 3.78541 liters. A sample run is shown below:

enter amount in quarts: 10 10 quarts is 9.463525 liters

Write a program named gas.py. The program must ask the user to input (in this order) the number of miles driven in a month, the average miles per gallon for a car, and the current price of gas. The program must then output the annual cost of gas based on those input and the annual cost of gas if the price of gas were to go up by a dollar per gallon. A sample run is shown below:

Enter number of miles driven per month: 1000

Enter average miles per gallon for your car: 25

Enter price of gas per gallon in dollars: 3.5

Annual gas cost: 1680.0

Annual gas cost if price goes up \$1: 2160.0

Comment your code and include your name and the class and time (CS160 1PM or CS160 2PM) as comments at the top of your files.

Test both your programs with a couple different inputs to be certain they are working correctly. After you have commented and tested your code, submit your programs along with your help.txt file by emailing them to [email protected] as attachments (send one email with three attachments) with the appropriate subject line. You must use Capital’s webmail as some email systems send attachments differently and I automatically extract the attachment based on the email address. Use the subject CS160-1ATT for the 1PM section and CS160-2ATT for the 2PM section. Make certain you also use the specified filenames toLiters.py and gas.py as I automate the testing.

If you realize you made a mistake, you may resubmit your program by resending all three attachments (before the due date), but please test your code before submitting it so you do not fill up my mailbox with a number of submissions. I only keep and grade the last submission.

1

• Lab-1-gas-toLiters.zip