Answer to Question #237757 in Python for Joel

Question #237757

Write your own function that illustrates a feature that you learned in this unit . The function must take time at least one argument .


1
Expert's answer
2021-09-17T02:04:40-0400
# 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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS