Question
# 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 intreact 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 should be acceptable. # Do NOT change any of the lines below if __name__ == "__main__": main() Please assist to solve the above python question. Below is the expected result for the above code.
========= RESTART: /Users/zli8/Desktop/Programming Assignment 2/main.py ======== Please enter the name of your cat: Blossom How would you like to interact with Blossom? Enter 'play' or 'feed': play Blossom says meow Would you like to continue? y: y How would you like to interact with Blossom? Enter 'play' or 'feed': play Blossom says meow Would you like to continue? y: y How would you like to interact with Blossom? Enter 'play' or 'feed': play Blossom is tired. Would you like to continue? y: y How would you like to interact with Blossom? Enter 'play' or 'feed': feed Blossom says nom Would you like to continue? y: y How would you like to interact with Blossom? Enter 'play' or 'feed': feed Blossom says nom Would you like to continue? y: y How would you like to interact with Blossom? Enter 'play' or 'feed': feed Blossom is full. Would you like to continue? y: n Goodbye
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started