I'm new to python and I'm trying to code a simple program, I've seen others' questions about the same error, however I'm not getting to apply any solution to my code.
for vh in range(len(self.parked_vehicles)):
if self.parked_vehicles[vh] == vehicle:
del(self.parked_vehicles[vh])
self.places += vehicle.size
self.parked = False
print('Vehicle unparked!')
When I try to test this code above with unittest I have this output:
if self.parked_vehicles[vh] == vehicle:
IndexError: list index out of range
What can I do in this situation? I'm not getting to solve it at all. Thanks.