def drop dest(routes,location):
for i in range(len(routes)):
if routes[i] == location:
routes.remove(routes[i])
return routes
I am using a function definition given a list as routes = [(3,2),(2,4),(5,5),(2,4)]
, and say I just want to remove the first occurrence value of (2,4)
. I am a little confused in how to do this because I do remove the value but I also remove the other value given. Where I just want to remove the first given value.