From a3b6471252ef30606e63ccf8d84e43ec700e5427 Mon Sep 17 00:00:00 2001 From: Samuel Weber Date: Sun, 15 Mar 2026 16:05:08 +0100 Subject: [PATCH] Aufgabe who likes it, Codewars Uebung kyu6 --- src/Woche4/Aufgabe_who_likes_it.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Woche4/Aufgabe_who_likes_it.py diff --git a/src/Woche4/Aufgabe_who_likes_it.py b/src/Woche4/Aufgabe_who_likes_it.py new file mode 100644 index 0000000..5654d08 --- /dev/null +++ b/src/Woche4/Aufgabe_who_likes_it.py @@ -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)] -- 2.30.2