1
0
forked from tdwojak/Python2017
This commit is contained in:
s45152 2017-12-02 13:30:47 +01:00
parent fde31ec283
commit 756fe1e9a3

View File

@ -9,10 +9,18 @@ Oba napisy będą składać się wyłacznie z małych liter.
""" """
def common_chars(string1, string2): def common_chars(string1, string2):
strg1 = list(string1) string1 = ''.join(sorted(string1))
strg2 = list(string2) string1 = string1.strip(' ')
sum = strg1 + strg2 string2 = ''.join(sorted(string2))
print(sorted(sum)) string2 = string2.strip(' ')
sorted_list = list()
for char in string1:
count = string2.count(char)
if count > 0:
if char not in sorted_list:
sorted_list.append(char)
return (sorted_list)
def tests(f): def tests(f):