Skip to content

Instantly share code, notes, and snippets.

@paulhendricks
Created June 12, 2019 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulhendricks/937f83df7a56a982496f1d982c6ef37e to your computer and use it in GitHub Desktop.
Save paulhendricks/937f83df7a56a982496f1d982c6ef37e to your computer and use it in GitHub Desktop.
spam = ['apple', 'banana', 'tofu', 'cats']
result = ', '.join(spam[:-1]) + ', and ' + spam[-1]
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment