How to find the maximum of 2 numbers?
value = -9999
run = problem.getscore()
I need to compare the 2 values i.e value and run and find the maximum of 2. I need some python function to operate it?
How to find the maximum of 2 numbers?
value = -9999
run = problem.getscore()
I need to compare the 2 values i.e value and run and find the maximum of 2. I need some python function to operate it?
# Python 3
value = -9999
run = int(input())
maxnum = run if run > value else value
print(maxnum)
There are multiple ways to achieve this:
def maximum(a, b): if a >= b: return a else: return b value = -9999 run = problem.getscore() print(maximum(value, run))
value = -9999 run = problem.getscore() print(max(value, run))
value = -9999 run = problem.getscore() print(value if value >= run else run)
But as you mentioned you are looking for inbuilt so you can use max()