1. 程式人生 > >python 3 if else 多重判斷示例

python 3 if else 多重判斷示例

python3 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!")


本文出自 “Dr小白” 博客,請務必保留此出處http://metis.blog.51cto.com/1203503/1954263

python 3 if else 多重判斷示例