Question: I need help fixing my code. IN PYTHON 3. I have two seperate files: main.py and pet.py. I imported pet into main, so I could

I need help fixing my code. IN PYTHON 3. I have two seperate files: main.py and pet.py. I imported pet into main, so I could use my Pet class. But when I run it, it says "Pet" is not defined. pictures of code and error screen are below.  I need help fixing my code. IN PYTHON 3. I have
two seperate files: main.py and pet.py. I imported pet into main, so
I could use my Pet class. But when I run it, it

Current file: main.py Load default template... 1 2 #Create your main code here 5 import pet 7 pet_owner - input("Please enter owner's name :") 8 Pet. pet owner - pet owner 9 pet_list - Il 10 while True: pet_name - input("Please enter the pet's nane") if pet_name - 'q' or pet_name -- 'Q: break age - int(input("Please enter the pet's age")) pet - Pet (pet name, age) pet list.append(pet) 17 print("Pet List:) 18 for pet in pet list: 19 print (pet) 13 Current file: pet.py - Load default template... 1 2 - Create your Pet class here class Pet: pet owner - "X" def __init_(self, name, age): self.pet_name = name self.pet_age - age def str (self): var - "{@) is {1} year(s) old and is owned by (2)".Format(self.pet_name, self.pet_age, Pet.pet_owner) return var Compare output Output differs. See highlights below. Sam I am Good Boi Input Jackson Your output ends with enter owner's name : Traceback (most recent call last): File "main.py", line 8, in Pet.pet_owner - pet_owner NameError: name 'Pet' is not defined Expected output ends with Pet List: Good Boi is 5 year(s) old and is owned by Sam I am Jackson is 7 year(s) old and is owned by Sam I am

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!