python——判断三个数字中的最大值


#判断三个数中最大值
n1= int(input('please enter the firest number:'))
n2 = int(input('please enter the second number:'))
n3 = int(input('please enter the third number:'))
max_num = 0

if n1 > n2:
max_num = n1
if n1 > n3:
max_num = n1
else:
max_num = n3
else:
max_num = n2
if n2 > n3:
max_num = n2
else:
max_num = n3
print('the max_num is:%d'%max_num)

'''

if n1>n2:
    max_num = n1
if max_num > n3:
print('the max_num is n1')
else:
print('the max_num is n3')
else:
max_num = n2
if max_num > n3:
print('the max_num is n2')
else:
print('the max_num is n3')
'''


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM