subject

Def find_max(nums: [int]) -> int: '''
Finds the maximum value in the given list of integers,
or None if the list is empty
'''
largest = None

for num in nums:
if largest == None or num > largest:
largest = num

return largest

Rewrite the find_max function so that it uses recursion to work its way through the list instead of using a loop. Your rewritten function should accept the same kinds of inputs (i. e., a one-dimensional list of integers) and generate the same outputs. In your view, is this a problem that's well-suited to a recursive solution in Python.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Which tab should you open to find the option for adding a header?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
Write a program that inserts the digits of an integer into an array in originalorderfollowed by reverse order. first, promptthe user to enter a positive integer(> 0). determine the number of digits of the integer. create a dynamically allocated integer arrayof a size twice the number of digits.now insert the digits in original order which will occupy half of the array. then, insert the digits in reverse order.finally, output thedigits in thearray.use at least two functions to organize your program.
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Alison is having a hard time at work because hee inbox is flooded with emails every day. some of these emails are unsolicited. some of other she don’t need. which action should she take to better manager her emails?
Answers: 1
You know the right answer?
Def find_max(nums: [int]) -> int: '''
Finds the maximum value in the given list of integer...
Questions
question
Mathematics, 20.04.2021 06:50
question
Mathematics, 20.04.2021 06:50
question
Mathematics, 20.04.2021 06:50
question
Mathematics, 20.04.2021 06:50
Questions on the website: 13722367