Ask Question
11 October, 04:40

Implement a function that meets the specifications below.

def max_val (t):

""" t, tuple or list

Each element of t is either an int, a tuple, or a list

No tuple or list is empty

Returns the maximum int in t or (recursively) in an element of t """

# Your code here

For example,

max_val ((5, (1,2), [[1],[2]])) returns 5.

max_val ((5, (1,2), [[1],[9]])) returns 9.

Paste your entire function, including the definition, in the box below. Do not leave any debugging print statements.

+4
Answers (1)
  1. 11 October, 05:19
    0
    Def sum_digits (s) : result=0; isSummed=False; for char in s: if char=="0" or char=="1" or char=="2" or char=="3" or char=="4" or char=="5" or char=="6" or char=="7" or char=="8" or char=="9": result+=int (char); if not isSummed: isSummed=True; if not isSummed: raise ValueError (); else: return int (result);
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Implement a function that meets the specifications below. def max_val (t): """ t, tuple or list Each element of t is either an int, a ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers