摘要: 废话不多说,直接上程序 从最高优先级依次计算到最低优先级 # and or not # print(2 > 1 and 1 < 4) print(2 > 1 or 1 < 4 or 2 < 3 and 9 > 6 and 3 < 2) # 优先级 ()> not > and > or # 上面程序运 阅读全文
posted @ 2019-07-16 21:57 套你大象 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 作用 当while循环被break打断时,执行后面语句。例如: count = 0 while count <= 5 : count += 1 if count == 3:break print("Loop",count) else: print("循环正常执行完啦") print(" out of 阅读全文
posted @ 2019-07-16 16:16 套你大象 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 作用 通过格式化输出我们可以实现模板化 注意 当使用格式化输出%时应注意与设置地输入对应,即 #自我介绍格式化输出 name = input("请输入名字:") age = input("请输入年龄:") height = input("请输入身高:") msg = "我叫:%s,今年:%s,身高% 阅读全文
posted @ 2019-07-16 15:38 套你大象 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 1 #1,使用while循环12345678910 while True: print(1) print(2) print(3) print(4) print(5) print(6) print(7) print(8) print(9) print(10) 2 #输出1——100的所有奇数 num 阅读全文
posted @ 2019-07-16 00:03 套你大象 阅读(79) 评论(0) 推荐(0) 编辑