Write a python program to input n numbers from user, store these numbers
in a tuple and print maximum, minimum number along with the sum and
mean of all the elements from this tuple.
Answers
n = int(input("Enter the number of integers you'd like to enter: "))
print()
l = list()
for i in range(n):
x = int(input("Enter the integer: "))
l.append(x)
print()
print()
nl = tuple(l)
print(nl, "is your given tuple.")
print()
print(max(nl), "is the HIGHEST value in the tuple.")
print()
print(min(nl), "is the LOWEST value in the tuple.")
print()
print(sum(nl), "is the SUM of the values in the tuple.")
print()
s = sum(nl)
l = len(nl)
mean = s/l
print(mean, "is the MEAN of the tuple.")
Answer:
python program
Explanation:n = int(input("Enter the number of integers you'd like to enter: "))
print()
l = list()
for i in range(n):
x = int(input("Enter the integer: "))
l.append(x)
print()
print()
nl = tuple(l)
print(nl, "is your given tuple.")
print()
print(max(nl), "is the HIGHEST value in the tuple.")
print()
print(min(nl), "is the LOWEST value in the tuple.")
print()
print(sum(nl), "is the SUM of the values in the tuple.")
print()
s = sum(nl)
l = len(nl)
mean = s/l
print(mean, "is the MEAN of the tuple.")