小Y的Python学习日志--流程控制(逻辑符)

Python逻辑运算符详解
本文通过实例详细介绍了Python中的三种逻辑运算符:and、or 和 not 的使用方法。包括如何结合输入判断条件来运用这些逻辑运算符进行程序控制。

#本文仅为个人学习过程的整理和记录,如有从他人博客、网站摘录的内容,本人会明确标明,如有涉及侵权,请联系本人,本人会在第一时间删除。

   以下的资料整理来自(1)廖雪峰的Python教程 http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000

            (2)简明Python教程 http://woodpecker.org.cn/abyteofpython_cn/chinese/

 

(1)逻辑运算符 and

  x=int(input('Please Input x : '))
  y=int(input('Please Input y : '))
  if x>=60 and y>=60:
   print('Good')
  else:
   print('Bad')

(2)逻辑运算符 or

  x=int(input('Please Input x : '))
  y=int(input('Please Input y : '))
  if x>=80 or y>=80:
   print('Good')
  else:
   print('Bad')

(3)逻辑运算符 not

  def fun():
   return 0
  x=int(input('Please Input x : '))
  y=int(input('Please Input y : '))
  if not fun():
   print('ok')

转载于:https://www.cnblogs.com/liquidbean/p/4321066.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值