num = 0 count = 0 total = 0 while num != 'x': num = input('Enter a number: ') if num != 'x': num = int(num) count = count + 1 total = total + num print('Total:', total) print('Average:', total / count)