Compute Tuple Length

Tags: length, tuple

Write a Python program to find the length of a tuple.

Example 1:

Input: (1, 2, 3, 4, 5) 
Output: 5

Example 2:

Input: ('a', 'b', 'c', 'd', 'e') 
Output: 5

Use the len() function for this task.

def find_length(t):
    return len(t)

© Let’s Data Science


Unlock AI & Data Science treasures. Log in!