class Friends:
def init(self, connections):
self.connections = connections
self.q = list(connections)
def add(self, connection):
self.connection = connection
if connection not in self.q:
(self.q).append(connection)
return True
else: return False
def remove(self, connection):
self.connection = connection
if connection in self.q:
(self.q).remove(connection)
return True
else: return False
def names(self):
k = []
for x in self.q:
for i in x:
if i not in k:
k.append(i)
return set(k)
def connected(self, name):
self.name = name
k = []
for s in self.connections:
if self.name in list(s):
if list(s)[1] not in k:
k.append(list(s)[1])
return set(k)
why connected isn't working ??
Created at: 2015/04/06 18:25; Updated at: 2015/04/06 18:25