RosettaCodeData/Task/Comma-quibbling/Python/comma-quibbling-2.py
2015-02-20 09:02:09 -05:00

5 lines
225 B
Python

def commaQuibble(s):
return '{%s}' % ' and '.join(s).replace(' and ', ', ', len(s) - 2)
for seq in ([], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]):
print('Input: %-24r -> Output: %r' % (seq, commaQuibble(seq)))