Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
min max python 1

min max python

April 10, 2022 by Anurag batra
def clamp(n, minn, maxn):
    return max(min(maxn, n), minn)

Here is what the above code is Doing:
1. It’s creating a function called clamp.
2. It’s taking three arguments: n, minn, and maxn.
3. It’s returning the maximum of minn and n, and the minimum of maxn and n.

Categories Python Examples
Post navigation
sort and remove duplicates list python
four digit representation python
© MyEduKit - 2022 . All Rights Reserved.