26 lines
596 B
Python
26 lines
596 B
Python
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
|
||
|
"""
|
||
|
Napisz funkcję common_chars(string1, string2), która zwraca alfabetycznie
|
||
|
uporządkowaną listę wspólnych znaków z lańcuchów string1 i string2.
|
||
|
"""
|
||
|
|
||
|
def common_chars(string1, string2):
|
||
|
pass
|
||
|
|
||
|
|
||
|
def tests(f):
|
||
|
inputs = [["this is a string", "Ala ma kota"]]
|
||
|
outputs = [[' ', 'a', 't']]
|
||
|
|
||
|
for input, output in zip(inputs, outputs):
|
||
|
if f(*input) != output:
|
||
|
return "ERROR: {}!={}".format(f(*input), output)
|
||
|
break
|
||
|
return "TESTS PASSED"
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
print(tests(common_chars))
|