# Create A BMI Calculator and Animal Classifier in Python Assignment Solution.

## Instructions

Objective
Write a python assignment program to create a BMI calculator and animal classifier

## Requirements and Specifications

Create a program with the following details
• Bag end broken
• Animal classifier
•  BMI
Source Code
```BAG END BROKEN import sys sys.path.append('../..') from graphics import * def main():     win = GraphWin('Bag End', 200, 150) # give title and dimensions     sky = Rectangle(Point(0, 0), Point(200, 200))     sky.setFill("skyblue")     sky.draw(win)     hill = Oval(Point(-100, 50), Point(300,400))     hill.setFill("green")     hill.draw(win)     house = Rectangle(Point(25, 75), Point(175, 150))     house.setFill(color_rgb(120, 95, 10))     house.draw(win)     window1 = Circle (Point(48, 105), 10)     window1.setFill("blue")     window1.draw(win)     window2 = Circle (Point(152, 105), 10)     window2.setFill("blue")     window2.draw(win)     door = Circle(Point(100, 120), 29)     door.setFill(color_rgb(10, 75, 10))     door.draw(win)     doorknob = Circle(Point(100, 120), 4)     doorknob.setFill(color_rgb(10, 55, 10))     doorknob.draw(win)     win.getMouse() #============================================================= # Testing code below - DO NOT EDIT # Only run this code below if this is called as the main, not imported if __name__ == '__main__':     # from ledgerpy.ledger import grab     #     # FILE = "bagEnd_broken"     # grab(FILE)     main() ANIMAL CLASSIFIER # From: https://www.researchgate.net/publication/315146311_ANIMAL_CLASSIFICATION_IN_WILDLIFE_THROUGH_IMAGES_USING_STATISTICAL_METHODS_AND_DECISION_TREE AMPHIBIAN = "Amphibian" BIRD = "Bird" FISH = "Fish" INSECT = "Insect" MAMMAL = "Mammal" REPTILE = "Reptile" #....................... 2 .............................. # Modify the following data structure to match your defined test cases. # The inputs to the test cases are next represented by Boolean values # (must be True and False, case sensitive) # that align to one of the input values in the following order: # skeleton, wings, feathers, eggs, milk, meta, gills TEST_CASES = [[INSECT , [False, False, False, False, False, False, False]],               [BIRD , [False, False, False, False, False, False, False]],               [MAMMAL , [False, False, False, False, False, False, False]],               [MAMMAL , [False, False, False, False, False, False, False]],               [AMPHIBIAN , [False, False, False, False, False, False, False]],               [REPTILE , [False, False, False, False, False, False, False]],               [FISH , [False, False, False, False, False, False, False]]] # The following code, AnimalClassifier, is a class. It helps to group data # and is a vital part of Object-Oriented programming. We won't do a lot with # classes in this course, but they are important later. For now, it is just a way # of grouping the various properties to classify an animal. class AnimalClassifier:     hasSkeleton = False     hasWings = False     hasFeathers = False     laysEggs = False     drinksMilk = False     undergoesMetamorphasis = False     hasGills = False #................... 3 ..........................................     def classify(self):         ''' Use the attributes of the Animal Classifier task to determine the animal    self - an grouping of the AnimalClassifier attributes  returns the class of the animal with those properties         '''         if self.hasSkeleton:             if self.hasWings:                 if self.hasFeathers:                     return BIRD                 else:                     return MAMMAL             else:                 if not self.laysEggs:                     if self.drinksMilk:                         return MAMMAL                 if self.undergoesMetamorphasis:                     return AMPHIBIAN                 else:                     if self.hasGills:                         return FISH                     else:                         return REPTILE         else:             return INSECT #================================================================== # Everything below here is tester code DO NOT MODIFY     def __init__(self, skeleton, wings, feathers, eggs, milk, meta, gills):         ''' Initializes the class with the provided values         '''         self.hasSkeleton = skeleton         self.hasWings = wings         self.hasFeathers = feathers         self.laysEggs = eggs         self.drinksMilk = milk         self.hasGills = gills         self.undergoesMetamorphasis = meta def getBoolean(prompt):     ''' Prompt the user a question that is answered true or false    prompt - the text to ask the user  returns True or False as specified by the user     '''     while True:         answer = input(prompt).lower()         if (answer == "true" or answer == 't'):             return True         elif (answer == "false" or answer == 'f'):             return False         else:             print("You must answer True (t) or False (f)") def presentToUser():     ''' Ask the user a series of questions that help to classify the animal and then show them the result     '''     hasSkeleton = getBoolean("Does your animal have a skeleton:")     hasWings = getBoolean("Does it have wings:")     hasFeathers = getBoolean("Does it have feathers:")     laysEggs = getBoolean("Does it lay eggs:")     drinksMilk = getBoolean("Does its young drink milk:")     undergoesMetamorphasis = getBoolean("Does it undergo a metamorphasis:")     hasGills = getBoolean("Does it have gills:")     classifier = AnimalClassifier(hasSkeleton, hasWings, hasFeathers, laysEggs,                                   drinksMilk, undergoesMetamorphasis, hasGills)     print("Your animal is a", classifier.classify()) def testClassifier():     ''' Test the classify logic using the test cases defined above     '''     success = True     for testCase in TEST_CASES:         answer = testCase[0]         parameters = testCase[1]         test = AnimalClassifier(parameters[0], parameters[1], parameters[2], parameters[3],                                 parameters[4], parameters[5], parameters[6])         result = test.classify()         if result != answer:             success = False             print ("Test case Failed: I expected", answer, "but got", result, "for the inputs", parameters)     return success def testPlatypus():     ''' A special test for the platypus  returns true if the test passes     '''     success = True     answer = MAMMAL     parameters = [True, False, False, True, True, False, False]     test = AnimalClassifier(parameters[0], parameters[1], parameters[2], parameters[3],                             parameters[4], parameters[5], parameters[6])     result = test.classify()     if result != answer:         success = False         print ("Platypus Test case Failed: I expected", answer, "but got", result, "for the inputs", parameters)     return success if __name__ == '__main__':     import sys     sys.path.append('..')     from utils.ledger import grab     FILE = "animalClassifier"     grab(FILE)     if testClassifier() and testPlatypus():         print("All test cases passed!")     print(".................")     print("Classify your own animal now...")     presentToUser() BMI def computeBMIEmpirical(heightInInches, weightInLbs):     return 703 * weightInLbs / heightInInches ** 2 def main():     name = input("What is your name? ")     height = eval(input("Height (inches): "))     weight = eval(input("Weight (lbs): "))     bmi = computeBMIEmpirical(height, weight)     if bmi >= 18.5 and bmi < 25:         status = "Normal"     elif bmi >= 30:         status = "Obese"     elif bmi <= 18/5:         status = "Underweight"     else:         status = "Overweight"     print(name, ", your BMI is", bmi, "which means you are", status) #============================================================= # Testing code below - DO NOT EDIT # Only run this code below if this is called as the main, not imported if __name__ == '__main__':     import sys     sys.path.append('..')     # from ledgerpy.ledger import grab     #     # FILE = "bmi"     # grab(FILE)     main()```