How do I set a maximum limit for an integer in Python I tried using an if statement and it works but i thought there might be a better way to do that
code i'm using to do that works fine
f = 100
f = f + 15
if(f > 100):
f = 100
print(f)
also tried to use a function but it gives an error after a while
def limit(f):
if(f > 100):
return 100
calling function
f = limit(f)
like writing two lines of code everytime time f changes is not a big deal but it would be better if there was a shorter way