0
write a function which return min max and average of all numbers when the list of integers is given as input.
7 Antworten
+ 4
Okay, then please do that! Have fun!
If you need help, we need to see your code.
+ 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...
+ 1
Then put your calculations in a function and return the values. Functions are explained in the Python Core course, review the lessons.
+ 1
A͢J okay 👍
0
Lisa
A=list (map(int, input ().spilt ()))
print(min(A))
print(max(A))
print(sum(A)/Len(A))
0
Lisa but the thing is we want to make function and return max ,min and avg .
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.