#Python(063)if...else敘述的應用
'''
if...else敘述的基本語法:

if(條件判斷):
    程式區塊碼
else:
    程式區塊碼

'''
i, j = eval(input('Please enter two integer:'))
if (i > j):
    print(f'{i}為最大值\n')
else:
    print(f'{j}為最大值\n')

k, m = eval(input('Please enter two integer:'))

Max = k if k > m else m
print(f'{Max}為最大值')

max_ = max(k, m)
print(f"{max_}為最大值")

min_ = min(k, m)
print(f"{min_}為最小值")
#max和min為內建函數

 

結果為:

image

arrow
arrow
    創作者介紹
    創作者 愛學習 的頭像
    愛學習

    愛學習

    愛學習 發表在 痞客邦 留言(0) 人氣()