KnowledgeBoat Logo

Computer Science

Write a program to input n numbers from the user. Store these numbers in a tuple. Print the maximum and minimum number from this tuple.

Python

Python Tuples

30 Likes

Answer

n = eval(input("Enter the numbers: "))

tup = tuple(n)

print("Tuple is:", tup)
print("Highest value in the tuple is:", max(tup))
print("Lowest value in the tuple is:", min(tup))

Output

Enter the numbers: 3,1,6,7,5
Tuple is: (3, 1, 6, 7, 5)
Highest value in the tuple is: 7
Lowest value in the tuple is: 1

Answered By

16 Likes


Related Questions