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:
def commacode(mylist): mylist[-1] = 'and ' + mylist[-1] mystring = ', '.join(mylist) return mystring spam = ['apple', 'bananas', 'tofu', 'cats'] print commacode(spam)