if,else语句猜最大值

num1 = input("Num1:")
num2 = input("Num2:")
num3 = input("Num3:")

max_num = 0

if num1 > num2:
    max_num = num1
    if max_num > num3:
        print("Max number is", max_num)
    else:
        print("Max num is", num3)
else:
    num1 < num2
    max_num = num2
    if max_num > num3:
        print("Max number is", max_num)
    else:
        print("Max num is", num3)

 

以下代码用于猜测num1,num2,num3中的最大值,注意书写格式:
 
num1 = input("Num1:")
num2 = input("Num2:")
num3 = input("Num3:")

 

max_num = 0

 

if num1 > num2:
  max_num = num1
  if max_num > num3:
    print("Max number is", max_num)
       else:
    print("Max num is", num3)
else:
  num1 < num2
  max_num = num2
  if max_num > num3:
    print("Max number is", max_num)
  else:
    print("Max num is", num3)
posted @ 2018-06-15 09:14  evatan123  阅读(179)  评论(0编辑  收藏  举报