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