Python Assignments

Assignment 1: car_sales.py

Write a car sales flowchart and program. The program should ask the user for the price of the vehicle. The program should figure tax (6.25% x price of vehicle). Add a dealer prep fee as a variable and set it to $100, a license fee at $150 and doc fee (1.5% the value of the vehicle). Use comments, appropriate variables and prompts and good output that will display the data that you included in the program and a total.

Assignment 2:

Write a program that converts distances measured in kilometers to miles. One kilometer is approximately 0.62 miles. The message to the user should be user friendly, as in “100km is 62 miles”. Save as kmTomiles.py

Assignment 3:

Write a program that prompts the user for a distance in km and a gas milage(Km/L) and then outputs the amount of gas (in litres) needed to travel that distance. The message to the user should be user friendly, as in “You need 40L of gas to travel 100km”. Save as litres_needed.py.

Assignment 4:

Write a program that assigns integer variables a,b values and print the sum, difference, product, and modulus. Save as operations.py

Assignment 5:

Write a program that lets you enter a number of hours, and that converts it to days and hours. For example, 111 hours = 4 days and 15 hours. (HINT: %)  Save it as hoursToDays.py.

Share with your network
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • RSS

Leave a Reply

Your email address will not be published. Required fields are marked *