0

I’m trying to print out the pets in the first position in the list, i didnt get error but i cant print them out

https://code.sololearn.com/c1PBlh8mYYRg/?ref=app

28th Mar 2022, 12:27 AM
Lenoname
6 Antwoorden
0
Jay Matthews Following your logic i even tried to look for a matching as the first pet in the petlist, in ownerlist. for a in ownerlist: if a.pets == petlist[0]: print(ā€found)ā€) Something wrong with it?
28th Mar 2022, 1:05 AM
Lenoname
0
Jay Matthews ok nice, i’m trying to find which owner has a certain pet, so when i get a match i would print(a.name,a.lastname) Instead of ā€foundā€ Atleast thats how i’m thinking
28th Mar 2022, 1:25 AM
Lenoname
0
Jay Matthews u mean aside from typeofpet, name, gender and age? That would mean the pets had already owners from beginning and it wasnt assigned to them
28th Mar 2022, 1:45 AM
Lenoname
0
When i’m making a pet and putting it in the petlist i have to declare an owner also otherwise i will get an error. Petx= cat(ā€catā€, ā€catnameā€, ā€maleā€, 4) This would then cause an error because i didnt give the pet an owner
28th Mar 2022, 2:23 AM
Lenoname
0
Looks like your issue is about accessing the first element in your list. Try using pets to print the item. If it’s still not showing, maybe you’re printing the whole object instead of the string. Works kind of like tracking Dog Vitamins—specific, not general. https://camelus.co.za/collections/dog-vitamins Dog Vitamins
21st Aug 2025, 4:09 PM
arman ali