Answer:
The code is given below in python
# Code Block 1
count = 0 # count variable
total = 0 # total variable
enter = '' # input variable
while enter != 'stop':
enter = input('Enter a grade:' )
if enter != 'stop' and enter.isdigit():
total += int(enter) # add to total value
count = count + 1 # then to the count
print float(total) / count
# Code Block 2
numbers = []
while enter != 'stop':
enter = input('Enter a grade:' )
if enter != 'stop':
numbers.append(int(enter))
print sum(numbers) / float(len(numbers))