I am unable to figure out where to add a while-loop to my already finished code to get the min and max to work correctly : My issue is not knowing how to properly configure this section of coding to get the max and min to work properly.

"For the max/min logic to work correctly,
it had to be placed WITHIN a loop, not after it.
Due to that, a WHILE loop would have been preferred.
(Or use correctly the max() and min() methods.)"

I have tried moving the if statements that include the max and min statements around to no avail. Python 3.7.3, using IDLE. 

def user_grade(statistic = None):
    f = []
    for grade in range(5):
        if statistic == "max":
            print('Max: {}'.format(max(f)))
        if statistic == "min":
            print('Min: {}'.format(min(f)))
        f.append(float(input("Enter Grade (percentage): ")))

    else:       
        print('Average: {}'.format(sum(f)/len(f)))

Expected Output: #Numbers will vary depending on user input.
Enter Grade (percentage): 99
Enter Grade (percentage): 98
Enter Grade (percentage): 97
Enter Grade (percentage): 96
Enter Grade (percentage): 95
Max: 99.0
Average: 97.0
None  #The 'min" should be here instead of None. 

#Current Output
Traceback (most recent call last):
 line 22, in <module>
    print(user_grade('max'))
   line 13, in user_grade
    print('Max: {}'.format(max(f)))
ValueError: max() arg is an empty sequence