I have a for loop as below in python 3.4
def checkCustometers(self):
for customer in self.customers_waiting:
if customer.Source == self.location: #if the customer wants to get on at this floor,
self.customers_inside_elevators.append(customer) #place customer into elevator
self.customers_waiting.remove(customer) #The customer isent waiting anymore
Lets say for example at
customer_waiting[4]
if customer.Source == Self.location
Then the loops deletes
customer_waiting[4]
and customer_waiting[5]
and goes to position 4. The loop then goes on and looks at
customer_waiting[5]
but its is actually looking at customer_waiting[6]
skipping customer_waiting[5]
How can i fix this?