def drop dest(routes,location): for i in range(len(routes)): if routes[i] == location: routes.remove(routes[i]) return routes >
def drop dest(routes,location): for i in range(len(routes)): if routes[i] == location: routes.remove(routes[i]) return routes
It's simple, use list.remove.
list.remove
>>> routes = [(3,2),(2,4),(5,5),(2,4)] >>> routes.remove((2,4)) >>> routes [(3, 2), (5, 5), (2, 4)]