Ask Question
9 April, 14:43

Write a function called find_max that takes in a single parameter called random_list, which should be a list. This function will find the maximum (max) value of the input list, and return it. This function will assume the list is composed of only positive numbers. To find the max, within the function, use a variable called list_max that you initialize to value 0. Then use a for loop to loop through random_list. Inside the list, use a conditional to check if the current value is larger than list_max, and if so, re-assign list_max to store this new value. After the loop, return list_max, which should now store the maximum value from within the input list.

+1
Answers (1)
  1. 9 April, 16:25
    0
    see explaination

    Explanation:

    python code

    def find_max (random_list):

    list_max=0

    for num in random_list:

    if num > list_max:

    list_max=num

    return list_max

    print (find_max ([1,45,12,11,23]))
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a function called find_max that takes in a single parameter called random_list, which should be a list. This function will find the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers