Aufgabe who likes it, Codewars Uebung kyu6
This commit is contained in:
parent
f9a07bc96c
commit
f68082d252
13
src/Woche4/Aufgabe_who_likes_it.py
Normal file
13
src/Woche4/Aufgabe_who_likes_it.py
Normal 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)]
|
||||||
Loading…
x
Reference in New Issue
Block a user