Answer:
Step-by-step explanation:
The following code is written in Python. It is a function that takes in a list of ints as a parameter. It then creates two variables one for sum and for max. It then loops through the list adding all the values to sum and adding only the largest value to max. Then it creates a variable called avg which calculates the average by dividing the variable sum by the number of elements in the list. Finally, it returns both avg and max to the user.
def avg_and_max(my_list):
sum = 0
max = 0
for x in my_list:
sum += x
if x > max:
max = x
avg = sum / len(my_list)
return avg, max