#!/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)))