I have next code and I create objects for every entry pet:

```
from itertools import groupby
class Petshop():
    def __init__(self, entryDate, name, ownerName):
        self.entryDate = entryDate
        self.name = name
        self.ownerName = ownerName

class Pets():
    def __init__(self):
        self.petsList = []

    def addPets(self, entryDate, name, ownerName):
        entry_pet = Petshop(entryDate, name, ownerName)
        self.petsList.append(entry_pet)

    def printPets(self):
        self.petsList.sort(key=lambda p: p.entryDate)
        counter = 0
        for group in groupby(self.petsList, key=lambda p: p.entryDate):
            ls = list(group)
            print("---------------", ls[0], '------------------')
            for pet in list(ls[1]):
                print("Name:", pet.name)
                print("Owner name:", pet.ownerName)
                if pet.name in list(ls[1]):
                    counter += 1
                print('There are ',counter,'pets with the same name')

pet = Pets()

pet.addPets('04/13/2021','Pinky', 'David Smith')
pet.addPets('07/10/2020', 'Charlie', 'Joe Davis')
pet.addPets('04/13/2021','Pinky', 'Daniel Trincot')
pet.addPets('07/10/2020', 'Kenny', 'Susan Jones')
pet.addPets('12/22/2018', 'Teddy', 'Carl Johnson')
pet.addPets('07/10/2020', 'Kenny', 'Richard Campbell')
pet.addPets('04/13/2021','Max', 'Bryan Miller')
pet.addPets('07/10/2020', 'Buddy', 'Kathy Brown')
pet.addPets('07/10/2020', 'Kenny', 'John Brown')
pet.printPets()

```

With that code I would like to count how many repeated pets entry by date, so for example I expect in console:

```
--------------- 04/13/2021 ------------------
Name: Pinky
Owner name: David Smith
Name: Pinky
Owner name: Daniel Trincot
Name: Max
Owner name: Bryan Miller
There are 2 pets with the same name
--------------- 07/10/2020 ------------------
Name: Charlie
Owner name: Joe Davis
Name: Kenny
Owner name: Susan Jones
Name: Kenny
Owner name: Richard Campbell
Name: Buddy
Owner name: Kathy Brown
Name: Kenny
Owner name: John Brown
There are 3 pets with the same name
--------------- 12/22/2018 ------------------
Name: Teddy
Owner name: Carl Johnson
There are 0 pets with the same name

```

I tried to do that with:

```
if pet.name in list(ls[1]):
     counter += 1

```

But that does not work, because I think my code does not get into the if and I just get in console:

```
--------------- 04/13/2021 ------------------
Name: Pinky
Owner name: David Smith
There are  0 pets with the same name
Name: Pinky
Owner name: Daniel Trincot
There are  0 pets with the same name
Name: Max
Owner name: Bryan Miller
There are  0 pets with the same name
--------------- 07/10/2020 ------------------
Name: Charlie
Owner name: Joe Davis
There are  0 pets with the same name
Name: Kenny
Owner name: Susan Jones
There are  0 pets with the same name
Name: Kenny
Owner name: Richard Campbell
There are  0 pets with the same name
Name: Buddy
Owner name: Kathy Brown
There are  0 pets with the same name
Name: Kenny
Owner name: John Brown
There are  0 pets with the same name
--------------- 12/22/2018 ------------------
Name: Teddy
Owner name: Carl Johnson
There are  0 pets with the same name

```

So I come here for help.