Constraints

  • All functions are run through the main function
  • Define your functions first and then call functions as required
  • Feel free to use any pre-defined functions
  • Do not use any global variables
  • Format all decimal number output to 2 digits after the decimal point.
  • Avoid using break and continue statements
  • Avoid using exit()

Process and additional criteria:

a) Write a function to display your own full name, this course number (e.g. IS115), and the number of hours it took you to complete this assignment. Note there is no input statements inside this function.

b) Write a function that accepts the weight of a person in pounds as its parameter and returns the weight in kilograms. The simple conversion formula is: pounds / 2.2

c) Write a function that accepts as its parameters, the weight, height in feet, and height in inches and return the Body Mass Index (BMI). BMI is calculated as: weight in pounds * 703 / (height in inches2)

d) Write a function that accepts as its parameter 3 whole numbers representing the starting value, the end value, and the step size of a set of numbers to display. The functions display all whole numbers between the first and second number with an increment of the third number. If the first number is more than the second number, print an error message.

e) Write the main function to call these functions and perform the required tasks. In the main function:

  • Call your function to display the information
  • Ask the user for weight in pounds. Validate the number to make sure it is more than 0 (need a loop to validate). Call your function and show the converted value.
  • Ask the user for height in feet and height in inches, call your function, and display the value of BMI.
  • Ask the user for 3 numbers and call your function to display the data.

Here is the skeleton of a sample code that you may want to follow:

# display information
def info():

# convert weight in pounds to kilograms
def convertWeight(weightPound):

# calculate Body Mass Index
def findBMI(weight, heightFeet, heightInches):

# display data
def displaydata (first, second, increment):

# the main function
def main():
# call the functions to process the data

main() ### call the main to start the process

Sample test run 1

Make sure to fully test your code. Make sure to re-create all the output shown in the sample runs.

Foo Bar
IS115
Number of hours to complete this assignment: 2 hours
Enter weight in pounds: 160
Weight in Kilograms = 72.73
Enter your height in feet: 5
Enter your height in inches: 8
BMI: 24.33
Enter starting value of a set of numbers to print: 4
Enter ending value of a set of numbers to print: 10
Enter the increment for the set of numbers to print: 2
4
6
8
10

Sample test run 2

Foo Bar
IS115
Number of hours to complete this assignment: 2 hours
Enter weight in pounds: -1
Invalid weight - Enter weight in pounds: -10
Invalid weight - Enter weight in pounds: 160
Weight in Kilograms = 72.73
Enter your height in feet: 5
Enter your height in inches: 8
BMI: 24.33
Enter starting value of a set of numbers to print: 10
Enter ending value of a set of numbers to print: 2
Enter the increment for the set of numbers to print: 2
There is no data to display!
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.