摘要: 度娘找答案 pycharm server 调节字体大小 ctrl+mouse scroll templates 阅读全文
posted @ 2021-01-11 23:12 老白脸儿 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 1 count = 0 2 while count < 3: 3 user = input("输入用户名:") 4 pwd = input("输入密码") 5 if user == 'alex' and pwd =='123': 6 print("欢迎登陆") 7 break 8 else: 9 p 阅读全文
posted @ 2021-01-11 22:06 老白脸儿 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 完全中止循环 whlie 条件表达式1: 执行代码 if 条件表达式2: break for 迭代变量 in 对象: if 条件表达式: break 阅读全文
posted @ 2021-01-11 21:51 老白脸儿 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 终止本次循环而提前进入到下一次循环中 while 条件表达式1: 执行代码 if 条件表达式2: continue 1 count = 0 2 while count < 10 3 if count == 7: 4 count = count + 1 5 continue 6 print(count 阅读全文
posted @ 2021-01-11 21:39 老白脸儿 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 在python3中,无论输入的是数字还是字符,都将被作为字符串读取。如果想要接受数值,需要把接收到的字符串进行类型转换 例: 1 inp = input('请输入数字:') 2 print(type(inp)) 3 new_inp = int(inp) 阅读全文
posted @ 2021-01-11 20:56 老白脸儿 阅读(186) 评论(0) 推荐(0) 编辑
摘要: ## 使用while循环输入 1、2、3、4、5、6、8、9、10 方法一: 1 n = 1 2 while n < 11: 3 if n == 7: 4 pass 5 else: 6 print(n) 7 n += 1 方法二: 1 a = 0 2 n = 1 3 while a < 10: 4 阅读全文
posted @ 2021-01-11 01:24 老白脸儿 阅读(267) 评论(0) 推荐(0) 编辑