Question: I have been struggling with getting the below Python code question to run. Please can i get help?# DO NOT CHANGE THE FILENAME: cat.py #

I have been struggling with getting the below Python code question to run. Please can i get help?# DO NOT CHANGE THE FILENAME: cat.py # IMPORTANT: Before you submit, make sure your program produces # the expected result as shown in the assignment description class Cat: #The Cat class must have the following: #A name attribute that is intialized when a cat is created. #An energy attribute that has an initial value of 2. #A stomach capacity attribute that has an initial value of 2. #A method called play(). If the value of energy is greater than 0, # it prints a message similar to "cat name says meow" and then reduces the value of energy by 1. # The message has to contain the name of the cat and the sound meow. # However, if the value of energy is less than or equal to 0, it prints "cat name is tired" instead. #A method called eat(). If the capacity of stomach is greater than 0, # it prints a message similar to "cat name says nom" and then reduces the capacity of stomach by 1. # The message has to contain the name of the cat and the sound nom. # However, if the capacity of stomach is less than or equal to 0, it prints "cat name is full" instead.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!