11 lines
277 B
Python
11 lines
277 B
Python
from collections.abc import Sequence
|
|
|
|
|
|
def list_to_sentence(list: Sequence[str]) -> str:
|
|
match len(list):
|
|
case 0:
|
|
return str()
|
|
case 1:
|
|
return list[0]
|
|
case _:
|
|
return " and ".join((", ".join(list[0:-1]), list[-1]))
|