fork download
  1. print('Unfortunately you are allowed to invite only two people')
  2.  
  3. people_to_invite = ['leonardo da vinci', 'jorden b peterson', 'jeffrey kaplan', 'joshua meyer', 'harold', 'james bon', 'jakie chan']
  4.  
  5. for people in people_to_invite:
  6. print(len(people_to_invite), people_to_invite)
  7. if len(people_to_invite) > 2:
  8. place_holder = people_to_invite.pop()
  9. else:
  10. break
  11.  
  12. for person in people_to_invite:
  13. print(f">>Dear {person.title()}, I would like to invite you to a dinner gathering at my home on Saturday,\nthe 15th, at 7 PM. It would be wonderful to have you with us!")
Success #stdin #stdout 0.13s 14128KB
stdin
Standard input is empty
stdout
Unfortunately you are allowed to invite only two people
7 ['leonardo da vinci', 'jorden b peterson', 'jeffrey kaplan', 'joshua meyer', 'harold', 'james bon', 'jakie chan']
6 ['leonardo da vinci', 'jorden b peterson', 'jeffrey kaplan', 'joshua meyer', 'harold', 'james bon']
5 ['leonardo da vinci', 'jorden b peterson', 'jeffrey kaplan', 'joshua meyer', 'harold']
4 ['leonardo da vinci', 'jorden b peterson', 'jeffrey kaplan', 'joshua meyer']
>>Dear Leonardo Da Vinci, I would like to invite you to a dinner gathering at my home on Saturday,
the 15th, at 7 PM. It would be wonderful to have you with us!
>>Dear Jorden B Peterson, I would like to invite you to a dinner gathering at my home on Saturday,
the 15th, at 7 PM. It would be wonderful to have you with us!
>>Dear Jeffrey Kaplan, I would like to invite you to a dinner gathering at my home on Saturday,
the 15th, at 7 PM. It would be wonderful to have you with us!