1
Is there a better way to do this? Assuming very long lists, is this slow and wasteful?
flavors = ['chocolate', 'vanilla', 'caramel', 'strawberry', 'coffee']
for flavor in flavors:
print(flavor, end = ', ' if (flavors.index(flavor) != len(flavors) -1) else '.')
Output:
chocolate, vanilla,...