A = 0 B = 0 D = 0 try: # test a block of code for errors while A == 0: C = int(input('Enter a number: ')) D = D + C B = B + 1 except ValueError: # execute this block if there is a value error if C == 'X': A = A + 1 print(' ') print('Total: ', D) print('AVERAGE: ', D/B)