Answers for "min max python"

2

python maths max value capped at x

def clamp(n, minn, maxn):
    return max(min(maxn, n), minn)
Posted by: Guest on April-10-2020
1

python get min from array

>>> arr = [1, 3.14159, 1e100, -2.71828]
>>> min(arr)
-2.71828
Posted by: Guest on March-12-2020
1

min max python

def min_max(*n):
  return {"min":min(n),"max":max(n)}
print(min_max(-10,1,2,3,45))
Posted by: Guest on July-09-2021
12

min() python

x = min(1, 2) #Sets the value of x to 1
Posted by: Guest on March-28-2020
0

max and min int in python

max_int = pow(2, 31)-1
min_int = pow(-2, 31)
Posted by: Guest on August-05-2021
0

min max code in python

listA = [18, 19, 21, 22]
print('The smallest number from listA is:', min(listA))  	# 18
print('The largest number from listA is:', max(listA))		# 22

strA = 'AppDividend'
print('The smallest character from strA is:', min(strA))	# A
print('The largest character from strA is:', max(strA))		# v

strA = 'AppDividend'
strB = 'Facebook'
strC = 'Amazon'
print('The smallest string is:', min(strA, strB, strC))		# Amazon
print('The largest string is:', max(strA, strB, strC))		# Facebook
Posted by: Guest on April-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language