I have written a code with a list of invitees but as I am popping the uninvited guests from the list, the for loop stops running at index 3 and instead of first two people in the list, first four get invited. please point out what's wrong. Thanks
invitees = ["name1","name2","name3","name4","name5","name6"]
print(invitees)
print("Sorry guys change in plans, cannot invite all of you guys")
#using pop() to invite only two from the list of invitees
for invitee in invitees:
if len(invitees)>2:
popped_invitee = invitees.pop()
print(f"Sorry! {popped_invitee.title()}, you are uninvited")
print(invitees)
#the univited get a message and also the invited
for invitee in invitees:
print(f"hey! {invitee.title()}, you are still invited")