Answer:
Program to this question can be defined as below:
Program:
Num=[] #defining an empty list
count = int(input("Enter total number in the elements: ")) #insert total element
s=0 # defining variable s
print('Enter elements: ')#message
for i in range(1, count+ 1): #loop to calculte sum
val = int(input())#defining val to collect values
s=s+val; # defining variable and add values
avg=s/count; #calculate avg
Num.append(val) #add values in list
print("Smallest number: ",min(Num))#print Smallest number
print("Largest number: ",max(Num))#print Largest number
print("Average number: ",avg)# print Average
Output:
Enter total number in the elements: 3
Enter elements:
8
7
1
Smallest number: 1
Largest number: 8
Average number: 5.333333333333333
Explanation:
In the above program first, define an empty list and use a loop to insert all elements in the list, inside the list an "s" variable is used, to add all elements. In the list and another variable "avg" is used to calculates its average value.
- In the next line, python min and max, which is inbuilt method.
- These methods use the print method that prints its maximum, minimum, and average number.