Answer:
In Python:
nums = []
larg= []
small = []
while True:
for i in range(10):
num = int(input(": "))
nums.append(num)
print("Smallest: "+str(min(nums))); print("Largest: "+str(max(nums)))
larg.append(max(nums))
small.append(min(nums))
another = int(input("Press 1 to for another sets: "))
nums.clear()
if not another == 1:
break
print("Average Large: "+str(sum(larg)/len(larg)))
print("Average Small: "+str(sum(small)/len(small)))
Explanation:
This initializes the list of input numbers
nums = []
This initializes the list of largest number of each input set
larg= []
This initializes the list of smallest number of each input set
small = []
This loop is repeated until, it is exited by the user
while True:
The following iteration is repeated 10 times
for i in range(10):
Prompt the user for input
num = int(input(": "))
Add input to list
nums.append(num)
Check and print the smallest using min; Check and print the largest using max;
print("Smallest: "+str(min(nums))); print("Largest: "+str(max(nums)))
Append the largest to larg list
larg.append(max(nums))
Append the smallest to small list
small.append(min(nums))
Prompt the user to enter another set of inputs
another = int(input("Press 1 to for another sets: "))
Clear the input list
nums.clear()
If user inputs anything other than 1, the loop is exited
<em> if not another == 1:</em>
<em> break</em>
Calculate and print the average of the set of large numbers using sum and len
print("Average Large: "+str(sum(larg)/len(larg)))
Calculate and print the average of the set of smallest numbers using sum and len
print("Average Small: "+str(sum(small)/len(small)))