From 776abbce40a25dda066cf0f827a0f933c3053efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20G=C3=B3ralczyk?= <andgor@st.amu.edu.pl> Date: Sat, 2 Jun 2018 20:04:15 +0000 Subject: [PATCH] rozwiazanie zad11 --- labs02/task11.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/labs02/task11.py b/labs02/task11.py index 7d36767..4bc74a7 100644 --- a/labs02/task11.py +++ b/labs02/task11.py @@ -9,7 +9,24 @@ Oba napisy będą składać się wyłacznie z małych liter. """ def common_chars(string1, string2): - pass + n= string1 + m= string2 + li = [] + if len(n) >= len(m): + for i in range(len(n)): + for j in range(len(m)): + if n[i] == m[j]: + li.append(n[i]) + + else: + for i in range(len(m)): + for j in range(len(n)): + if m[i] == n[j]: + li.append(m[i]) + li = list(set(li)) + li.remove(' ') + li.sort() + return li def tests(f):