流程控制之if判断

流程控制之if判断

1.if语法1

classify='human'

 sex='female'
 age= 18
 if classify=='human' and sex=='female' and age<30 and age>16:
     print('表白')
 print('打扰了')


 2.if语法2
 classify='human'
 sex='female'
 age=38
 if classify=='human' and sex=='female' and age<30 and age>23:
     print('表白')
 else:
     print('阿姨好!')
 print('end...')


3. if语法3
 如果,成绩>=90,那么:优秀
 如果成绩>=80且<90,那么:良好
 如果成绩>=70且<80,那么:普通
 其他情况:很差
 score=input('Please Input Your Score:')
 score=int(score)
 if score>100:
     print('怎么可能')
 elif score>90:
     print('优秀')
 elif score>80:
     print('良好')
 elif score>70:
     print('普通')
 else:
     print('很差')
 print('end...')


 4.if练习4
 user='xiaoming'
 password='aixiaohong'
 user_input=input('Please Input Your Name:')
 password_input=input('Please Input Your Password:')
 if password_input==password and user_input==user :
     print('welcome')
 else:
     print('user or password is error')


 5.if练习
 age=int(input('please input age of your girlfriend:'))
 sex=input('please input sex of your girlfriend')
 is_success=False
 if age<30 and age>18 and sex=='female':
     print('该表白了')
     if is_success:
         print('我爱你')
     else :
         print('我逗你玩呢!哈哈')
 else :
     print('不适合你')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值