Skip to main content
3 of 3
update formatting

This can be achieved with no loops and no joins, just two print statements:

def commalist(listname):
    print(*listname[:-1], sep = ', ',end=", "),
    print('and',listname[-1])

the end parameter in the first print will determine whether to use oxford comma.

Mike K
  • 111
  • 2