From 6bce9cdb6a018c418b561141f74077d69112f744 Mon Sep 17 00:00:00 2001 From: s45147 Date: Sat, 16 Dec 2017 20:27:32 +0100 Subject: [PATCH] task11 fixed --- labs02/task11.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/labs02/task11.py b/labs02/task11.py index 62e180d..28e7808 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -11,13 +11,10 @@ Oba napisy będą składać się wyłacznie z małych liter. def common_chars(string1, string2): wspolne = [] - for z1 in string1: - for z2 in string2: - if z1 == z2: - wspolne.append(z1) - return wspolne.sort() - - + for z in string1.replace(" ", ""): + if z in string2.replace(" ", "") and z not in wspolne: + wspolne.append(z) + return sorted(wspolne) def tests(f): inputs = [["this is a string", "ala ma kota"]]