Number comparison to find max/min in python

后端 未结 3 2018
再見小時候
再見小時候 2021-01-28 04:51

I am a beginner in python. I have written a simple program to find greatest of 3 numbers. I get the right answer when I give input numbers having same number of digits (Eg. 50 8

3条回答
  •  半阙折子戏
    2021-01-28 05:31

    You can find the maximum of any number of numbers with max

    print "The greatest number is " + max(int(num1), int(num2), int(num3))
    

提交回复
热议问题