Computer Science, asked by vinay2461, 5 days ago

1. WRITE A PROGRAM TO FIND MAXIMUM VALUE FROM THE TUPLE
2.WRITE A PROGRAM TO FIND MINIMUM VALUE FROM THE TUPLE
3.WRITE A PROGRAM TO SEARCH THE GIVEN ELEMENT IN THE TUPLE
4.WRITE A PROGRAM TO FIND THE AVERAGE OF THE ELEMENTS OF THE TUPLE

Answers

Answered by shrihankp
0

Answer:

1.

tuple1=(2,4,1,9)

print(max(tuple1)) # 9

2.

tuple2=(3,6,2,9)

print(min(tuple2)) # 2

3.

def find_item(item, tuple):

print(True if item in tuple else False)

tuple3=(5,1.3,10)

find_item(2, tuple3) # false

find_item(1, tuple3) # true

4.

sum=0

tuple4=(1,2,3,4)

for item in tuple4:

sum+=item

avg=sum / len(tuple4)

print(avg) # 2.25

Similar questions