""" File : lab09.py Name : Information : You should add code to the functions outlined below. When you load this file it will automatically test the functions you have written. If everything is done correctly than the output will all say pass. If you have problems it will either error or fail. Do NOT change the code already written """ ##Section One """This is the only section where you will write code""" def hydrocarbon(hydrogen,carbon,oxygen): """Calculates the atomic mass of the given hydrocarbon""" # Add your code here def bmi(weight,height): """Calculates the bmi of the person with the given weight (lbs) and height (inches).""" #Add your code here def collatzLength(seed): """Calculates the number of steps required to move from the seed value to the base value of 1""" #Add your code here ##Section Two """Do NOT change the code below this section This is the test suite. It helps you test if your code is correct and complete. If you get messages about incorrect values then you should look at the message to find the expected value and see what you can do to fix the code ABOVE this.""" print("Start checking for errors.") result=hydrocarbon(4,3,0) expected=40.0646 if not result==expected: print("hydrocarbon(4,3,0) produces",result,"expected",expected) result=hydrocarbon(1,2,3) expected = 73.0281 if not result==expected: print("hydrocarbon(1,2,3) produces",result,"expected",expected) result=hydrocarbon(0,0,0) expected = 0 if not result==expected: print("hydrocarbon(0,0,0) produces",result,"expected",expected) result=hydrocarbon(-1,0,0) expected = None if not result==expected: print("hydrocarbon(-1,0,0) produces",result,"expected",expected) result=hydrocarbon(0,-1,0) if not result==expected: print("hydrocarbon(0,-1,0) produces",result,"expected",expected) result=hydrocarbon(-1,0,0) if not result==expected: print("hydrocarbon(-1,0,0) produces",result,"expected",expected) print() result=bmi(150,66) expected=24.210365225138165 if not result==expected: print("bmi(150,66) produces",result,"expected",expected) result=bmi(150,0) expected=None if not result==expected: print("bmi(150,0) produces",result,"expected",expected) result=bmi(0,66) expected=None if not result==expected: print("bmi(0,66) produces",result,"expected",expected) print() start = [0,1,2,3,4,5,6,7,8,9] expected = [None,0,1,7,2,5,8,16,3,19] for index in range(len(start)): result = collatzLength(start[index]) if not result==expected[index]: print("collatzLength("+str(start[index])+") produces",result, "expected",expected[index]) print("Done checking for errors.")