python基础-条件语句if

if语句:

if 判断条件:

  执行语句

else:

  执行语句

flag = False
name = 'huipaodexiong'
if name == 'python':
    flag = True
    print('欢迎')
else:
    print(name)

 

num = 5
if num == 3:
    print("我是3")
elif num == 2:
    print("2")
elif num ==1:
    print("1")
elif num < 0:
    print("erro")
else:
    print("会跑的熊")

 

num = 19
if num >=0 and num <=10:
    print("大于等于0,小于等于10")
else:
    print("error")

 

posted @ 2017-06-07 00:53  R-Bear  阅读(251)  评论(0编辑  收藏  举报