forked from tdwojak/Python2017
Done
This commit is contained in:
parent
fde31ec283
commit
756fe1e9a3
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user