I am trying to write a for loop in python to pop out all the items in a list but two, so I tried this:
guest = ['john', 'phil', 'andy', 'mark', 'frank', 'joe']
for people in guest:
popped_guest = guest.pop()
print("I am sorry " + popped_guest + " I can no longer invite you to dinner")
Run Code Online (Sandbox Code Playgroud)
and this is what I get when I run it:
I am sorry joe I can no longer invite you to dinner
I am …