774530750 发表于 2018-8-14 06:22:33

python 3 if else 多重判断示例

# -*- coding:utf-8 -*-  
Man = 27
  
guess_age_of_people = int (input("guess age:"))
  
#python 3.x 默认变量类型为字符串,数字需要应int () 方式进行整形
  
if guess_age_of_people == Man :
  
    print("It is true!")
  
elif guess_age_of_people > Man :
  
    print("It is bigger!")
  
else:
  
    print("It is small!")
页: [1]
查看完整版本: python 3 if else 多重判断示例