64 752
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #3394 in Python for mukunda

Question #3394
In the above example in-built min function is used to calculate the minimum value of the tuple. Write a function to calculate the minimum of tuple and also average of the tuple.
Expert's answer
def my_min_and_avg (tuple):
min = tuple[0]
sum = 0
for s in tuple:
& min = (min < s) and min or s
& sum += s
return min, sum/len(tuple)

tuple = (10, 20, 30)
print(my_min_and_avg(tuple))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions