forked from tdwojak/Python2017
python_01
This commit is contained in:
parent
54f08133aa
commit
b1299c5c49
@ -9,11 +9,26 @@ Oba napisy będą składać się wyłacznie z małych liter.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def common_chars(string1, string2):
|
def common_chars(string1, string2):
|
||||||
slowo = sort(sum(c1 == c2 for c1, c2 in zip(string1, string2)))
|
|
||||||
print (slowo)
|
string1 = set(string1.replace(" ",""))
|
||||||
|
string2 = set(string2.replace(" ",""))
|
||||||
|
|
||||||
|
common = []
|
||||||
|
for c1 in string1:
|
||||||
|
for c2 in string2:
|
||||||
|
if c1 == c2:
|
||||||
|
common.append(c1)
|
||||||
|
common.sort()
|
||||||
|
return common
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# slowo = sum( c1 == c2 for c1, c2 in zip(string1, string2))
|
||||||
|
# print(slowo)
|
||||||
|
# return slowo
|
||||||
|
|
||||||
def tests(f):
|
def tests(f):
|
||||||
inputs = [["this is a string", "ala ma kota"]]
|
inputs = [["this is a string", "ala ma kota"]]
|
||||||
outputs = [['a', 't']]
|
outputs = [['a', 't']]
|
||||||
|
Loading…
Reference in New Issue
Block a user