数getMax()関数を定義し、3つの数(キーボードから入力した整数)の最大値を返します.
471 ワード
数getMax()関数を定義し、3つの数(キーボードから入力した整数)の最大値を返します.列の例:1番目の整数を入力してください:10 2番目の整数を入力してください:15 3番目の整数を入力してください:20最大値は:20です
def getMax():
n1=int(input(" 1 :"))
n2=int(input(" 2 :"))
n3=int(input(" 3 :"))
t=0
if n1>n2:
t=n1
else:
t=n2
if t>n3:
return " :"+str(t)
else:
return " :"+str(n3)
maxValue=getMax()
print(maxValue)