• Bug in friends?

 

When I run and check it is giving a

Your result: {'stephen', 'robot', 'sophia', 'nikola', 'pilot'} Right result: {"nikola", "sophia", "pilot"}

However when I chesc it by console it is print everything ok.

f = Friends(({"nikola", "sophia"}, {"stephen", "robot"}, {"sophia", "pilot"}))

f.remove({"stephen", "robot"})

True

f.names()

{'nikola', 'pilot', 'sophia'}

I belive there is something wrong with auto testing.

CODE: class Friends:

connections = []


def __init__(self, connections):

    for pair in connections:
       self.connections.append(pair)
def remove(self, connection):
    if connection in self.connections:
        self.connections.remove(connection);
        return (True)

    else:
        return (False)
def names(self):
    friends=[]
    friends=set(friends)
    for i in self.connections:
        i=list(i)
        if not i[0] in friends:
            friends.add(i[0])
        if not i[1] in friends:
            friends.add(i[1])    


    print (set(friends))
    return (friends)

From: https://checkio.org/mission/friends/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
8