O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

3-7. Shrinking Guest List:

From

Cover of Python Crash Course

Note

message1 = 'Hi, '
message2 = 'would you like to join me for dinner tonight?'
names = ['Ruby', 'Java', 'Jay', 'Alicia']
loop = 0
for name in names:
print(message1 + name + message2)
absentee = 'Java'
newguest0 = 'Linux'
print("Oops, it looks like " + absentee + "could not make it!")
print("Invite " + newguest0 + " then!")
print("The revised invitation list: ")
names.remove(absentee)
names.append(newguest0)
print(names)
print("Oops, we have a bigger table, let's invite more people!")
newguest1 = "Windows"