Merge pull request 'Aufgabe who likes it, Codewars Uebung kyu6' (#4) from Woche4 into master

Reviewed-on: #4
This commit is contained in:
Samuel Weber 2026-03-15 16:09:22 +01:00
commit a9ea2a43df

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