In: Computer Science
Number Analysis Program Python:
Initialize an array with these specific 20 numbers: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51
Display the following data:
1. The lowest number in the list
2. The highest number in the list
3. The total of the numbers in the list
4. The average of the numbers in the list
#source code:
numbers=[26,45,56,12,78,74,39,22,5,90,87,32,28,11,93,62,79,53,22,51]
min=numbers[0]
max=numbers[0]
sum=0
length=len(numbers)
for i in range(length):
if(numbers[i]<min):
min=numbers[i]
if(numbers[i]>max):
max=numbers[i]
sum=sum+numbers[i]
print("The lowest number in the list:",min)
print("The highest number in the list:",max)
print("The total of the numbers in the list:",sum)
print("The average of the numbers in the list:",sum/length)
#output:
#if you have any doubt comment below..if you like give thumbs up...