pyBegin / projects / comma-code
📖

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 ca…

22 linesRunnable

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.