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
7 Antworten
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?
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
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
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
0
Hey, I had the same issue! Make sure you're accessing the first element using `pets[0]`. If that still doesnât print, check your list content. I faced this while organizing my list of Calming Dog Treatsâturns out the list was empty. Hope that helps!
https://highv.co.uk/
Calming Dog Treats
0
I had the same issue when printing the first pet in the listâno error, but nothing showed. Make sure you're actually accessing index 0 correctly. By the way, while debugging, my dog chilled beside me thanks to Calming Pet Treats. Total lifesaver!
https://www.cbd-uk.com/calming-dog-treats
Calming Pet Treats