Practice Assignment 1

I noticed during Thursday's quiz that relatively few of you had problems with the programming. Most of you who had problems, had problems with:

Therefore, this exercise should help you to practice. It will also help you to practice writing simple functions that follow the IPO process.

All of these functions should be saved into a program, and then imported into Python. Then confirm that they work by running them in the Python interpreter.

BMI calculation

Write a function, bmi(), that will ask the user for his weight and height and display the body mass index of the person. The formula for BMI is weight (in kg) divided by the square of height (in m).

Temperature Calculation

Write a function, temperatureConversion(), that will ask the user for the temperature in Fahrenheit and display the corresponding temperature to Celsius. The formula is celsius = (fahrenheit - 32)*5/9.

Currency Conversion

Write a function, currencyConversion(), that will ask the user for the cost of an item in US dollars and display the corresponding cost in HK dollars. The currency conversion rate is 1 USD = 7.78 HKD.

Due Date

This is a practice assignment, we won't grade it, so there's no due date. However, for practice, I strongly suggest that you do it. Moreover, when you write your programs, put away your notes, close all other programs. Write it from scratch and do not copy. I guarantee you, if you can repeat this exercise every day from now till Thursday, you will not have any problems with the next quiz.