zoukankan      html  css  js  c++  java
  • 20190616——and和or使用方法、python运算符总结、python数据类型

     1 """ 如果有括号:先计算括号内
     2     如果没有括号:
     3     执行顺序:从前到后
     4     结果:True or ==》True
     5         True and ==》继续走
     6         False or ==》继续走
     7         False and ==》Flase
     8 """  
     9 user = 'ales'
    10 pwd = '123'
    11 v1 = user == 'ales' and pwd == '1233' or user == 'alex' and pwd == '1273' and user == 'alets'
    12 v2 = user == 'ales' and (pwd == '1233' or user == 'alex' and pwd == '1273')
    13 print(v1)
    14 print(v2)

    》》》》》》

    False
    False

     1 结果是值:
     2     算数运算
     3         a=10*10
     4     赋值运算
     5         a=a+1    a+=1
     6 
     7 结果是布尔值
     8     比较运算
     9         a=1>5
    10     逻辑运算
    11         a=1>6 or 1==1
    12     成员运算
    13         a=“稳” in “证件问”

    python数据类型详见转载文章:
    https://www.cnblogs.com/wupeiqi/articles/5444685.html#top

  • 相关阅读:
    hdu 2089 不要62(初学数位DP)
    字符串与整数之间的转换
    字符串之判断重复字符串
    字符串之全排列
    字符串之移位
    链表
    STL之map
    海量数据处理
    字符串之strchr
    字符串之_strncat
  • 原文地址:https://www.cnblogs.com/yssshiny/p/11037285.html
Copyright © 2011-2022 走看看