Question: 2 each (# 1-1 1), 3 (#1 2)) consider the following class definitions. as peslnts cass Anma(self, name, habitat): btt le self.habitat ir batse ExceptionC(0-10s)
2 each (# 1-1 1), 3 (#1 2)) consider the following class definitions. as peslnts cass Anma(self, name, habitat): btt le self.habitat ir batse ExceptionC(0-10s) is an invalid habitat for animal (1:12s) format (habitat, name)) seltname name class Horse (Animal): habitat land moves (selt); de print C'ia The horse named (0:10s) gallops on (1:8s)- format(self.name, self.habit class Whale(Animal) habitat ocean' def moves (self) print CVnThe whale named (0:10s) swims along (1:8s. format(Gelf.name, selfhabitaty dpriahe eagle named (0-10s) soars aloft:.format(self.name)) if habitat !-ground class Eagle(Animal): habitat- 'air def moves (self): class Snake: def init (self, name, habitat): raise Exception((0:10s) is an invalid habitat animal (1:12s)'. format (habitat, name)) self name name def moves (self): print('Vo The snake named (0:105) slithers along. format(selfname) Ed- Horse (Mr. Ed', 'land') Moby Whale (Moby Dick, 'ocean) Monty Snake (Python', 'ground') Angie Eagle ('Angeline', 'air)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
