O'Reilly logo
  • Jerry Pirkle thinks this is interesting:

Comma Code

From

Cover of Automate the Boring Stuff with Python

Note

spam = ['apples', 'bananas', 'tofu', 'cats']
cheese = [1, 3, 2, 4, 'Alice', 'Bob']
l = spam

x=0
while (x < len(l) - 1):
print(l[x], end=", ")
x += 1

print('and ' + l[-1])