# Python program to specify Number of Integers and Compute their Average

**Python program to specify Number of Integers and Compute their Average**

Below is the Python program that given a list of integers, computes their AVERAGE. The program expects a positive Integer as the Input to the “*Number of integers to enter*“, and exits gracefully with a custom message “*The value you entered is a non-Integer!*” otherwise. The program also checks if the numbers entered are positive integers and rejects any other type, requesting the user for a positive integer instead!

```
#!/usr/bin/python3
numberCount = 0
total =0
average = 0
n
upperLimit = input("How many numbers do you want to get the average on?: ")
if upperLimit.isdigit() == True:
upperLimit = int(upperLimit)
print("Please enter {} positive numbers to calculate their average! \n\n".format(upperLimit))
while numberCount < upperLimit:
number = input("Enter number:")
if number.isdigit() == True:
number = int(number)
```

numberCount += 1n
total += number
else:
print("The value you entered is a non-Integer!")
average = total / numberCount

print("\n\nYou entered {} positive numbers whose Average is: ".format(upperLimit) + str(average) + "!")
else:
print("The value you entered is a non-Integer!")

**Python program to specify Number of integers and Compute their AveragePython | thetqweb**