1/21/2021 10:02:54 AM
AJ. (INACTIVE)13 Answers
New Answersuppose we have this array/list of numbers a = [3,2,4,5] print(min(a)) #output: 2 print(max(a)) #output: 5 min stands for minimum max stands for maximum The Python max() function is used to find the largest value in a list of values. The Python min() function is used to find the lowest value in a list. The list of values can contain either strings or numbers.
It changes positive values to negative Example=27 will change to -27 by using abs function and vice versa
abs stands for absolute which returns the absolute value of the given number. eg print(abs(-3)) #output: 3 print(abs(3)) #output: 3
AJ. (INACTIVE) The abs() will return a floating point or an integer depending upon the argument. AJ have a look at the code https://code.sololearn.com/cgrcTC33ox7u/?ref=app
min and max return minimum and maximum value from the list. eg: l = [52,68,46,53,20,43] print(min(l)) #o/p 20 Print (max(l) #o/p 68
min() returns the minimum value and max() returns the maximum value of any kind of list a=[5, 2,1,4,6,2,7] Print(min(a)) #output 1 Print(max(a)) #output 7
Min function returns the smallest value among two integers while max returns the largest out of two
min print the smallest or minimum number of a certain function while max print the highest, biggest and maximum number of a certain function.
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message