# Number Analysis Program In Python

Looking for a way to do analysis on numbers using python then you are at the right place, In this tutorial we will create a number analysis program in python.

This python number analysis program will take in a list of numbers, it will do some analysis and print the following information about the numbers you have given it.

- Print sum of the numbers.
- Print average of the numbers.
- Print maximum of the numbers.
- Print minimum of the numbers.
- Print range of the numbers.
- Print median of the numbers.
- Print variance of the numbers.
- Print standard deviation of the number.

Above are all the things this program will print, you can add more analysis if you want so now let’s see how to do this program.

## Python Code For Number Analysis

```
# ask user to enter a list of numbers
numbers = input("Enter a list of numbers separated by comma: ")
# convert the input into a list of floats
numbers_list = [float(num) for num in numbers.split(',')]
# calculate the sum, average, maximum, and minimum of the numbers
total = sum(numbers_list)
average = total / len(numbers_list)
maximum = max(numbers_list)
minimum = min(numbers_list)
range_of_numbers = maximum - minimum
sorted_numbers = sorted(numbers_list)
# calculate the median of the numbers
if len(numbers_list) % 2 == 0:
median = (sorted_numbers[int(len(numbers_list)/2)] + sorted_numbers[int(len(numbers_list)/2)-1])/2
else:
median = sorted_numbers[int(len(numbers_list)/2)]
# calculate the variance and standard deviation of the numbers
variance = sum((x - average) ** 2 for x in numbers_list) / len(numbers_list)
standard_deviation = variance ** 0.5
# print the results
print("Sum: ", total)
print("Average: ", average)
print("Maximum: ", maximum)
print("Minimum: ", minimum)
print("Range: ", range_of_numbers)
print("Median: ", median)
print("Variance: ", variance)
print("Standard Deviation: ", standard_deviation)
```

Above is the code for number analysis, you can run this program on your system or you can use a **online python compiler**.

After running this code you will be asked to enter a list of numbers seperated by comma like this 1,2,44,5,5 make sure only enter numbers and hit enter and it will print the analysis, below is an example output of this program.

```
Enter a list of numbers separated by comma: 23,45,6,3,2,46,45,3
Sum: 173.0
Average: 21.625
Maximum: 46.0
Minimum: 2.0
Range: 44.0
Median: 14.5
Variance: 376.484375
Standard Deviation: 19.403205276448528
```

This was for this tutorial, I hope found this tutorial helpful and found what you were looking for, do share this tutorial with other programmers who might need it.

**Here are some more python programs:**

Want more tutorials like this then stay updated with us by joining our **telegram channel**, we post our latest tutorials and resources there.

Thanks for reading, have nice day 🙂