0

write a function which return min max and average of all numbers when the list of integers is given as input.

24th Mar 2022, 6:52 PM
Akash Gupta
Akash Gupta - avatar
7 Answers
+ 4
Okay, then please do that! Have fun! If you need help, we need to see your code.
24th Mar 2022, 7:51 PM
Lisa
Lisa - avatar
+ 2
Hi, According to me you want to return min, max, avg all at once. So you can calculate them and store there results in a list or tuple and can allocate with their respective indexes. I hope it helps...
26th Mar 2022, 5:37 AM
Himanshu Setia
+ 1
Then put your calculations in a function and return the values. Functions are explained in the Python Core course, review the lessons.
25th Mar 2022, 7:39 AM
Lisa
Lisa - avatar
+ 1
A͢J okay 👍
25th Mar 2022, 11:43 AM
Akash Gupta
Akash Gupta - avatar
0
Lisa A=list (map(int, input ().spilt ())) print(min(A)) print(max(A)) print(sum(A)/Len(A))
25th Mar 2022, 1:59 AM
Akash Gupta
Akash Gupta - avatar
0
Lisa but the thing is we want to make function and return max ,min and avg .
25th Mar 2022, 2:07 AM
Akash Gupta
Akash Gupta - avatar
0
Akash Gupta If you don't want to use inbuilt function then you can make your own function. You can store first value as a min value then compare with other values to get actual min value. Same you can do for max value. To get average you can add all elements then by dividing with number of elements, you can get average.
25th Mar 2022, 3:24 AM
A͢J
A͢J - avatar