Programming Examples

Python program to find maximum and minimum values in tuple


Write a program to input ‘n’ numbers and store it in a tuple and find maximum & minimum values in the tuple.

Solution

t=tuple()
n=int(input("Total number of values in tuple"))
for i in range(n):
    a=input("enter elements")
    t=t+(a,)
print ("maximum value=",max(t))
print ("minimum value=",min(t))
Output

Total number of values in tuple5

enter elements3

enter elements4

enter elements5

enter elements6

enter elements2

maximum value= 6

minimum value= 2

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz