def main(): bmi1 = BMI("John Doe", 18, 145, 70) print("The BMI from", bmi1.getName(), "is", bmi1.getBMI(), bmi1.getStatus()) bmi2 = BMI("Peter King", 50, 215, 70) print("The BMI for", bmi2.getName(), "is", bmi2.getBMI(), bmi2.getStatus())
def main(): bmi1 = BMI("John Doe", 18, 145, 70) print(f"The BMI for {bmi1.getName()} is \ {bmi1.getBMI()} {bmi1.getStatus()}") bmi2 = BMI("Peter King", 50, 215, 70) print(f"The BMI for {bmi2.getName()} is \ {bmi2.getBMI()} {bmi2.getStatus()}")
def main(): David = BMI(68, 185) print('David\'s BMI is :', end='') David.bmi_level() David.Taekwondo_level() print() Kevin = BMI(53, 172) print('Kevin\'s BMI is :', end='') Kevin.bmi_level() Kevin.Taekwondo_level() print()
def main(): bmi1 = BMI("John Doe", 18, 145, 70) print("The BMI for", bmi1.getName(), "is", bmi1.getBMI(), bmi1.getStatus()) bmi2 = BMI("Peter King", 50, 215, 70) print("The BMI for", bmi2.getName(), "is", bmi2.getBMI(), bmi2.getStatus())
def output_test(): global test_passed, test_failed #checking if output is as expected with the given inputs height_feet = 5 height_inches = 6 weight = 140 output = BMI(height_feet, height_inches, weight) if output == "Normal - 23.1": print("\033[92m Output Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Output Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1
def main(): bmi = BMI("Yongdae", 39, 89, 185) print(bmi.getName(), "의 BMI는", bmi.getBMI(), bmi.getState()) bmi = BMI("황지수", 43, 51, 162) print(bmi.getName(), "의 BMI는", bmi.getBMI(), bmi.getState())
def main(): b = BMI("seuni", 24, 167, 53) print("The BMI for", b.getName(), "is", b.getBMI(), b.getStatus()) b2 = BMI("peter", 50, 215, 70) print("The BMI for", b2.getName(), "is", b2.getBMI(), b2.getStatus())
def main(): bmi1 = BMI('John Doe', 18, 145, 70) print('The BMI for', bmi1.getName(), 'is', bmi1.getBMI(), bmi2.getStatus()) bmi2 = BMI('Angel', 50, 215, 70) print('The BMI for', bmi.getName(), 'is', bmi2.getBMI(), bmi2.get.Status())
def main(): bmi1 = BMI("Hongil Dong", 18, 145, 70) print("Name: ", bmi1.getName(), "....BMI:", bmi1.getBMI(), "Status:", bmi1.getStatus())
def input_test(): global test_passed, test_failed #test height upper bounds; height =< 9 feet, weight =< 1400 pounds height_feet = 9 height_inches = 1 weight = 1400 output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Upper Bound Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Upper Bound Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1 # test weight upper bounds; height =< 9 feet, weight =< 1400 pounds height_feet = 9 height_inches = 0 weight = 1401 output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Upper Bound Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Upper Bound Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1 #testing height lower bounds; height >= 1 feet 9 inches, weight >= 4.7 pounds height_feet = 1 height_inches = 8 weight = 5 output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Lower Bound Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Lower Bound Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1 #testing weight lower bounds; height >= 1 feet 9 inches, weight >= 4.7 pounds height_feet = 1 height_inches = 9 weight = 4 output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Lower Bound Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Lower Bound Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1 #testing for the right input types height_feet = 'a' height_inches = 9 weight = 4 output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Input Type Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Input Type Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1 height_feet = 5 height_inches = 9 weight = 'b' output = BMI(height_feet, height_inches, weight) if "Invalid parameter" in str(output): print("\033[92m Input Type Test Passed. Output: ", output, "\033[0m") test_passed = test_passed + 1 else: print("\033[91m Input Type Test Failed. Output: ", output, "\033[0m") test_failed = test_failed + 1
# Using our object from BMI import BMI from OOP import Parrot object = Parrot() # (.) means you are accessing the functions/behaviors of Parrot object.singing() object.dancing() object = BMI() object.get_bmi()