Programming Assignment #6

IDLE hands write devilish code.

Due Date : Wednesday, October 25th


In the first unit your programming assignment was normally one large assignment.  We haven't learned much about python yet so it is hard for us to do anything too big yet.  Instead, this assignment will ask you to use IDLE (review the video from the content materials for this week) to create three "short" scripts for some fictitious customers.  For each of these requests create a python script with the appropriate name.  Write and test your script to make sure it behaves as expected.

Customer Request #1 (

You are contacted by Dr. Al  Kyne who teaches chemistry at Whatsamata U.  He wants a tool that will allow him to calculate the molecular weight of certain hydrocarbons. 

He tells you that :

He wants you to write a piece of code that prompts the user for number of hydrogen atoms, then number of oxygen atoms, then number of carbon atoms (in that order).  It then calculates and prints a nice message regarding the molecular weight of that hydrocarbon.

It might look something like this:

Customer Request #2 (

You are contacted by Mr. Jim Class who is a PE teach who wants to have an easy tool for calculating BMI. He asks you to create a simple python script which will read in a user's weight in lbs and their height in feet and inches (separately) and then calculate and print their BMI.

Remember that the formula for BMI is:

You will need to determine how to convert from lbs to kg and from feet/inches to meters.

Sample output might look like this:

Customer Request #3 (

You are contacted by Mrs. Sue Barew who is the fleet manager for the cars owned by UNI. She wants you to create a simple python script which will help calculate the efficiency of the cars and see if the users were speeding. She asks you to write a program that takes in the car's mileage when the car leaves the motor pool, the cars mileage when it is returned to the motor pool, how much gas it took to fill up the car when it was returned, and how many hours the car reports that it was being driven. It will then calculate the total distance traveled, the miles per gallon and the miles per hour.

Sample output might look like this:

Submitting your assignment

When you have completed the assignment you should the homework submission system to upload the three files you were to create for this assignment.

Also, bring printouts of your code to class on the day that it is due.