from person import Person

__all__ = ['AddressBook']


class AddressBook(object):

    def __init__(self):
        self.persons = []
        self.groups = []

    def add_person(self, person):
        self.persons.append(person)

    def add_group(self, group):
        self.groups.append(group)

    def __contains__(self, item):
        if isinstance(item, Person):
            return item in self.persons
        return False

from group import Group

from person import Person

__all__ = ['AddressBook']


class AddressBook(object):

    def __init__(self):
        self.persons = []
        self.groups = []

    def add_person(self, person):
        self.persons.append(person)

    def add_group(self, group):
        self.groups.append(group)

    def __contains__(self, item):
        if isinstance(item, Person):
            return item in self.persons
        if isinstance(item, Group):
            return item in self.groups
        return False

Make it possible to check if some group is in the AddressBook or not
Make it possible to check if some group is in the AddressBook or not

+ from group import Group
+ 
  from person import Person
  
  __all__ = ['AddressBook']
  
  
  class AddressBook(object):
  
      def __init__(self):
          self.persons = []
          self.groups = []
  
      def add_person(self, person):
          self.persons.append(person)
  
      def add_group(self, group):
          self.groups.append(group)
  
      def __contains__(self, item):
          if isinstance(item, Person):
              return item in self.persons
+         if isinstance(item, Group):
+             return item in self.groups
          return False
  
Make it possible to check if some group is in the AddressBook or not
## Code Before:
from person import Person

__all__ = ['AddressBook']


class AddressBook(object):

    def __init__(self):
        self.persons = []
        self.groups = []

    def add_person(self, person):
        self.persons.append(person)

    def add_group(self, group):
        self.groups.append(group)

    def __contains__(self, item):
        if isinstance(item, Person):
            return item in self.persons
        return False

## Instruction:
Make it possible to check if some group is in the AddressBook or not
## Code After:
from group import Group

from person import Person

__all__ = ['AddressBook']


class AddressBook(object):

    def __init__(self):
        self.persons = []
        self.groups = []

    def add_person(self, person):
        self.persons.append(person)

    def add_group(self, group):
        self.groups.append(group)

    def __contains__(self, item):
        if isinstance(item, Person):
            return item in self.persons
        if isinstance(item, Group):
            return item in self.groups
        return False
