Write your own function that illustrates a feature that you learned in this unit . The function must take time at least one argument .
# Implementation of the analog of the len() function
# Returns the length of a list, string, turple
def get_len(arg):
res = 0
for _ in arg:
res += 1
return res
# example
print(get_len((1,3,4))) # return 3
print(get_len('test')) # return 4
print(get_len([])) # return 0
Comments
Leave a comment