How do I find the maximum of 2 numbers?


Question

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?

1
83
4/29/2019 7:01:18 PM

Accepted Answer

Use the builtin function max.

Example: max(2, 4) returns 4.

Just for giggles, there's a min as well...should you need it. :P

197
9/19/2018 3:23:52 PM


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon