Aufgabe who likes it, Codewars Uebung kyu6 #4

Merged
webersamuel merged 1 commits from Woche4 into master 2026-03-15 16:09:22 +01:00
Showing only changes of commit a3b6471252 - Show all commits

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