class ChatRoom:

    def __init__(self, name, user):
          self.name = name
          self.users = [user]

    def add_user(self, user):
        self.users.apend(user)
        self.users.sort()

    def remove_user(self, user):
        self.users.remove(user)
        return len (self.users)

class ChatRoom:

    def __init__(self, name, user):
          self.name = name
          self.users = [user]

    def add_user(self, user):
        self.users.apend(user)
        self.users.sort()

    def remove_user(self, user):
        if user in self.users:
            self.users.remove(user)
        return len (self.users)

Make sure user is in room's user list before removing
Make sure user is in room's user list before removing

  class ChatRoom:
  
      def __init__(self, name, user):
            self.name = name
            self.users = [user]
  
      def add_user(self, user):
          self.users.apend(user)
          self.users.sort()
  
      def remove_user(self, user):
+         if user in self.users:
-         self.users.remove(user)
+             self.users.remove(user)
          return len (self.users)
  
Make sure user is in room's user list before removing
## Code Before:
class ChatRoom:

    def __init__(self, name, user):
          self.name = name
          self.users = [user]

    def add_user(self, user):
        self.users.apend(user)
        self.users.sort()

    def remove_user(self, user):
        self.users.remove(user)
        return len (self.users)

## Instruction:
Make sure user is in room's user list before removing
## Code After:
class ChatRoom:

    def __init__(self, name, user):
          self.name = name
          self.users = [user]

    def add_user(self, user):
        self.users.apend(user)
        self.users.sort()

    def remove_user(self, user):
        if user in self.users:
            self.users.remove(user)
        return len (self.users)
