automate-boring-stuff/exercises/ex04/ex04a.py

12 lines
196 B
Python

def add(ls):
if len(ls) > 0:
ls = list(map(lambda x: str(x), ls))
ls[-1] = f"and {ls[-1]}"
print(", ".join(ls))
else:
print("")
add([0, 1, 2, 3])
add([])