Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# DO NOT CHANGE THE FILENAME: main.py # IMPORTANT: Before you submit, make sure your program produces # the expected result as shown in the

# DO NOT CHANGE THE FILENAME: main.py # IMPORTANT: Before you submit, make sure your program produces # the expected result as shown in the assignment description from cat import Cat def main(): #Complete the main() method below #1. Ask the user to enter the name of the cat #2. Create a Cat object using the name provided by the user #3. Ask how the user would like to interact with the cat. # The user can enter 'play' or 'feed'. # DO NOT use words other than 'play' or 'feed' for input. #4. Call the corresponding methods from the Cat class #5. Ask if the user would like to continue. If yes, repeat from #3 # The user can enter 'y' or 'n'. # Both uppercase or lowercase y/n should be acceptable. # Do NOT change any of the lines below if __name__ == "__main__": main()

Note: each time i tried to run this code ,it doesn't do any thing for me. Kindly advice:

def main():

cat_name = input("Please enter the name of your cat: ")

cat = Cat()

cat.set_name(Cat_name)

action = "y" while action == "y":

print("How would you like to interact cat (play/feed): ") action = input().upper() if(action == "PLAY"): cat.play() else: cat.eat() # ask user about choice

action = input("Would you like to continue? y/n: ").lower()

print("Goodbye!")

if __name__ == "__main__":

main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions