Question: Problem 2 Complete the function below. The function takes a single tuple as an argument. The tuple should have exactly 2 elements and should return

Problem 2 Complete the function below. The function takes a single tuple as an argument. The tuple should have exactly 2 elements and should return the sum of those 2 elements. In the event that the user supplies more than 2 elements, the function should return the string "Tuple must have exactly 2 elements!" . Example usage: add_tuple_elements((2, 3)) should return 5 And add_tuple_elements((2, 3, 6)) should return "Tuple must have exactly 2 elements!" Hint: You can determine how many elements are in a tuple (or a list) with the Python function len() |: def add_tuple_elements(atuple): return #The sum of the tuple elements or "Tuple must have exactly 2 elements
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
