Question: Python please Why does zybooks say that FoodItem improperly initialized with default constructor param values. name is: None fat is: 0 . 0 carbs is:
Python please Why does zybooks say that FoodItem improperly initialized with default constructor param values. name is: None fat is: carbs is: protein is: when it tests FoodItem constructor parameter defaults class FoodItem: # TODO: Define constructor with parameters to initialize instance # attributes name fat, carbs, protein def initself nameNone, fat carbs protein: self.name name self.fat fat self.carbs carbs self.protein protein def getcaloriesself numservings: # Calorie formula calories selffat selfcarbs selfprotein numservings; return calories def printinfoself: printNutritional information per serving of :formatselfname print Fat: :f gformatselffat print Carbohydrates: :f gformatselfcarbs print Protein: :f gformatselfprotein if namemain: fooditem FoodItem itemname input amountfat floatinput amountcarbs floatinput amountprotein floatinput fooditem FoodItemitemname, amountfat, amountcarbs, amountprotein numservings floatinput fooditemprintinfo printNumber of calories for :f servings: :fformatnumservings, fooditemgetcaloriesnumservings print fooditemprintinfo printNumber of calories for :f servings: :fformatnumservings, fooditemgetcaloriesnumservings
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
