Currently working my way through this beginners book and have completed one of the practice projects \'Comma Code\' which asks the user to construct a program which:
Here's my solution. Once I found the join method and how it worked, the rest followed.
spam = ['apples', 'bananas', 'tofu', 'cats'] def commas(h): s = ', ' print(s.join(spam[0:len(spam)-1]) + s + 'and ' + spam[len(spam)-1]) commas(spam)