blob: 89688fc67a89d7e2eaf85d2cb7a1ef50034cab9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/python
def is_equal(s1, s2):
'''
Returns true if the strings s1 and s2 encode the same information.
'''
if len(s1) != len(s2):
return False
for (x,y) in zip(s1,s2):
if x != y:
return False
return True
target, strs = "abc", [ "ab", "abc", "abcd", "bbc", "abe" ]
for s in strs:
print("{} == {} ? {}".format(target,s,is_equal(target,s)))
|