#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Datatime:2022/7/28 15:01
# Filename:016 Python 中的基本运算符.py
# Toolby: PyCharm
# https://www.cnblogs.com/nickchen121/p/10728299.html
# 变量
# 数据类型
# 输入输出
# 存不是目的, 取才是目的
# 现在计算机能认识客观世界的万事万物,但是呢,他还得对客观世界的万事万物作比较(逻辑运算、算术运算)
# 算术运算符
# +-*/ % //
a = 1
b = 2
print(a + b)
print(a - b)
print(a * b)
print(a / b)
print(a % b) # 取余
print(100 // 11) # 取整
# 布尔类型
# True 真
# False 假
# 比较运算符
print(a > b)
print(a < b)
print(a == b)
print(a != b)
# 赋值运算符
# =
c = 3
# +=
c += 3 # c = c + 3
print(c)
print('*'*100)
# 逻辑运算符
# AND、NOT、OR
# True and True # 左右两边都为 True,则为真,一边为假则为假
print(True and True)
print(2>1 and 1>0)
# True or False # 左右两边一边为 True,则为真
print(2>1 or 1>2)
print('*'*100)
# 身份运算符
# is
a = 'nick' # 开辟内存空间 1,a-->'nick'
b = a # b--》内存空间 1 的 'nick'
c = 'nick' # 开辟内存空间 2,c-->'nick'
print(a is b)
print(a is c)
# is not
print('*'*100)
# 成员运算符 ,列表
l =['a','bn','c']
# in
print('a' in l)
# not in
print('a' not in l)
print('*'*100)
# Python运算符优先级,你想让哪个优先,就在哪个上面加括号,括号里的最优先
print((a*1) in (l and c))
print((a*1))
print(l and c)
print('a' and 'b')
print('nick' in (l and c))