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([])