摘要: 8.字符串型name = 'jason' # str('jason')所有的数据类型都可以转成字符串类型print(type(str(18)))print(type(str(11.11)))print(type(str('hello')))print(type(str([1,2,3,4,5])))p 阅读全文
posted @ 2021-06-02 23:18 点滴180 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 1.整型的用途 年龄 生日 整数类型age = 18 # age = int(18) 这是他的原型。1.1 类型转换int()将括号内的数据转成整型print(int(123)) # 这个可以转成print(int('123')) # 这个也可以转成print(int('[1,2,3,4]')) # 阅读全文
posted @ 2021-06-02 22:23 点滴180 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 要求:1.错误的情况下只能猜三次。 2.正确的情况下直接退出游戏age = 18 count = 0while count < 3: guess_age = input('请输入您的年龄>>>:') guess_age = int(guess_age) if guess_age > age: pri 阅读全文
posted @ 2021-06-02 19:56 点滴180 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 一. 成员运算 in 和not in in(在...里面) not in(不在...里面) 比如说判断某个个体在不在群体内。print('a' in 'hello world aaa')字符串个体参与成员运算的时候通过print输出得到trueprint('hello' in 'hello worl 阅读全文
posted @ 2021-06-02 19:03 点滴180 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 在我们代码程序里面主要就三种结构1.顺序结构 自上而下,依次进行。(代码运行都是顺序结构)2.分支结构 代码运行到某个节点之后根据条件的不同执行不同的代码 分支结构的关键就是 if 判断 3.循环结构 代码运行到某个节点一直重复执行某一段代码 直到条件结束 循环结构的关键就是(while 和 for 阅读全文
posted @ 2021-06-02 08:24 点滴180 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 成员运算用到的有 in (判断在....里面) not in (判断不在....里面)比如说判断某个个体在不在群体内。print('a' in 'hello world aaa')# 字符串个体参与成员运算的时候# 通过print输出得到trueprint('hello' in 'hello wor 阅读全文
posted @ 2021-06-02 08:20 点滴180 阅读(68) 评论(0) 推荐(0) 编辑