Ask Question
19 August, 22:45

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. 19 August, 23:08
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers