Junior — Senior
Finding the largest element in an array
livecode
Task condition
Implement a function that takes an array of numbers and returns the highest value among them. You may rename the parameters if desired, but the function code itself should remain unchanged.
def find_max(arr):
max_val = arr[0]
for num in arr:
if num > max_val:
max_val = num
return max_val