Aufgabe who likes it, Codewars Uebung kyu6

This commit is contained in:
Samuel Weber 2026-03-15 16:05:08 +01:00
parent f9a07bc96c
commit a3b6471252

View File

@ -0,0 +1,13 @@
def likes(names):
length = len(names)
for i in range(4):
names.append("")
text = [
"no one likes this",
names[0] + " likes this",
names[0] + " and " + names[1] + " like this",
names[0] + ", " + names[1] + " and " + names[2] + " like this",
names[0] + ", " + names[1] + " and " + str(length - 2) + " others like this",
]
return text[length - (length > 3) * (length - 4)]