Science, asked by amogh4093, 10 months ago

Create a class called Animal that accepts two numbers as inputs and assigns them respectively to two instance variables: arms and legs. Create an instance method called limbs that, when called, returns the total number of limbs the animal has. To the variable name spider, assign an instance of Animal that has 4 arms and 4 legs. Call the limbs method on the spider instance and save the result to the variable name spidlimbs.

Answers

Answered by Anonymous
4

Answer:

SEE THE ANSWER

1. Create a class called Animal that accepts two numbers as inputs and assigns them respectively to two instance variables: arms and legs . Create an instance method called limbs that, when called, returns the total number of limbs the animal has. To the variable name spider, assign an instance of Animal that has 4 arms and 4 legs. Call the limbs method on the spider instance and save the result to the variable name spidlimbs. Save & Run Download Load History Show CodeLens Pair?

1. Create a class called Cereal that accepts three inputs: 2 strings and 1 integer, and assigns them to 3 instance variables in the constructor: name, brand, and fiber. When an instance of Cereal is printed, the user should see the following: "[name] cereal is produced by (brand) and has [fiber integer) grams of fiber in every serving!" To the variable name ci, assign an instance of Cereal whose name is "Corn Flakes" , brand is "Kellogg's", and fiber is 2. To the variable name c2, assign an instance of Cereal whose name is "Honey Nut Cheerios" brand is "General Mills", and fiber is 3 .

HEREBIS YOUR ANSWER

MARK AS BRAINLIST

Answered by mbbillahai
6

Answer:

class Animal :

   def __init__(self,arms, legs):

       self.arms = arms

       self.legs = legs

   def limbs (self):

       return self.arms+self.legs

spider = Animal(4,4)

spidlimbs = spider.limbs()

print(spidlimbs)

       

Explanation:

Similar questions