Conditions | 4 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python |
||
15 | def oxford_list(lst): |
||
16 | """Return Human-readable list of things obeying the object comma)""" |
||
17 | lst = sorted(lst) |
||
18 | if not lst: |
||
19 | return "(nothing)" |
||
20 | elif len(lst) == 1: |
||
21 | return lst[0] |
||
22 | elif len(lst) == 2: |
||
23 | return lst[0] + " or " + lst[1] |
||
24 | else: |
||
25 | return ", ".join(lst[:-1]) + ", or " + lst[-1] |
||
26 |