📖

Comma Code

Python22 lines· Joins a list of strings into a single human-readable string with commas and the word "and" before the last item (e.g. apples, bananas, tofu, and ca…
Original project by @ibra-kdbra — view source on GitHub
Ready when you are
README· what to build

Comma Code

Joins a list of strings into a single human-readable string with commas and the word "and" before the last item (e.g. apples, bananas, tofu, and cats).

Example

Running the script with the built-in list ["apples", "bananas", "tofu", "cats"] prints:

apples, bananas, tofu, and cats

How to run on localhost

python comma-code.py

Dependencies

Standard library only.

comma-code.py· Python 3.x
22 lines
Console· terminal