Define a function that computes the length of a given list or string. (It is true that Python has the len() function built in, but writing it yourself is nevertheless a good exercise.)
def myLen(iterable): counter = 0 for x in iterable: counter += 1 return counter def main(): myStr = "Hello there my friend" print(myLen(myStr)) myList = [1,2,3,4,5,6,7] print(myLen(myList)) mySet = {1,2,3,4,54,66} print(myLen(mySet)) if __name__ == '__main__': main()