bob手机客户端下载【网.址_yk490.COM】bob手机客户端下载【网.址_yk490.COM】bob手机客户端下载【网.址_yk490.COM】* 数据类型
```python
针对不同类型的数据用不同形式的方式对应
```
- 数据类型之整型与浮点型
数据类型之字符串(str)
'''引号引起来的内容''' 三种定义方式 '单引号' "双引号" '''三引号''' #字符中也含有引号,所有需要多种引号来确定引起的范围
数据类型之列表(list)
[]中括号括起来的内容 中括号内可存放多个元素,元素元素之间用逗号分开,元素可以是任意类型的数据 # 索引取值 从零开始取值,在计算机中起始值是0
数据类型之字典(dict)
大括号括起来的{} 大括号内部可以存放多个元素,元素的形式是Key:Value键值对,key是对value的描述性数据,一般情况下都是字符串,value可以使任意的数据类型 # 需要按键取值 字典内是无序的无法按索引取值
数据类型之布尔值(bool)
用于判断对错,真假 True False 1.布尔值默认为False 0,None,'',[],{},... 2.存储布尔值的变量名名一般都是习惯is开头 is-rught=True is-delete=False
数据类型之元组
小括号括起来的内容() 小括号内部可以存放多个元素,元素与元素之间逗号隔开,并且元素只能是不可变类型
数据类型之集合
大括号括起来的内容 大括号内部可以存放多个元素,元素与元素之间逗号隔开,并且元素只能是不可变类型
输入与输出
input print
格式化输出
占位符 %s %d %s可以替换任意数据类型 %d只可以替换数字 #打破规则需要特殊方式
运算符
数学运算 比较运算 增量赋值 链式赋值 解压赋值 # 程序员要尽可能的简化自己的操作
# 今日内容概要
- 运算符之逻辑运算
- 运算符之成员运算
- 运算符之身份运算
- 流程控制(重点)
- 数据类型常用内置方法
# 今日内容详细
## 运算符之逻辑运算
逻辑运算用于连接多个条件,进行关联判断,会返回布尔值True或者false
与 and
或 or
非 not
and 连接多个条件判断都需要满足
2>1 and 1==1 and True and 3>2
True
2>3 and 1==1 and True and 3>2
False
or 连接多个条件只要有一个满足就输出 True
2>1 or 1==1 and True and 3>2
True
2>3 or 1==2 and False and 3>4
False
not 取反对结果反向取值
not 1 == 1
False
not 2>10
True
'''
上述三个逻辑顺序符组合在一起使用,是有先后顺序的
3>4 and 4>3 or 1==3 and 'x' == 'x' or 3>3
但是我们一般不应该考虑先后顺序,而应该主动使用括号的形式
明确使用的先后顺序
联想小学学习的加减乘除
通过使用括号打破顺序
(3>4 and 4>3) or ((1==3 and 'x' == 'x') or 3>3)
'''
运算符之成员运算
--------
判断个体是否属于某个群体内
in 存在
not in 不存在
names=['jason','tony','jerry']
name1='tom'
print(n in names)
False
name2= 'jason'
print(name2 in names)
True
取反
print(name1 not in names)
True
name2= 'jason'
print(name2 not in names)
False
逻辑运算之身份运算
---------
值是否想等
==
内存地址是否相等
is
l1 = [11,22,33,44]
l2 = [11,22,33,44]
print(l1 == l2)
True
print(l1 is l2)
Fales
print(id(l1),id(l2))
'''
内存地址命令 id
值相等内存地址可能不等
内存地址相等值一定相等
'''
流程控制
----
流程控制既是控制流程,具体指控制程序的执行流程,而程序的执行流程分为三种结构:
顺序结构
之前我们写的代码都是顺序结构
分支结构
用到if判断
循环结构
用到while与for
### 流程控制之分支结构
依据条件的真假进行判断做什么(让计算机模仿人类的思维模式)
使用
if
elif
else
判断运算的流程,三者只会有一个执行(执行了if就不会执行elif和else...同理...)
代码结构
if 条件1: # 如果条件1的结果为True,就依次执行:代码1、代码2,......
代码1
代码2
......
elif 条件2: # 如果条件2的结果为True,就依次执行:代码3、代码4,......
代码3
代码4
......
elif 条件3: # 如果条件3的结果为True,就依次执行:代码5、代码6,......
代码5
代码6
......
else: # 其它情况,就依次执行:代码7、代码8,......
代码7
代码8
......
'''条件可以使单个 也可以是用逻辑运算符链接的多个条件的组合'''
age=36
if age > 35:
print('阿姨好')
else:
print('小姐姐好')
用户的登录功能
获取用户的用户名和密码
username = input('username>>>:')
password = input('password>>>:')
判断用户名密码是否正确
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=2...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=2...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=2...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=k...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...
https://github.com/search?q=%...