python全栈开发 1循环 2break和continue的区别 3格式化输出 4运算符 5编码 一.流程控制while循环 while条件: 代码块(循环体) 1.死循环; while True; print(".....") 例: while True: print('你是萌萌么') #死循环 永远都停不下来 # 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 你是萌萌么 ....... 2.break循环: 变量 =…
一.while循环 1.基本循环(死循环) while 条件: 循环体 2.使用while计数 count = 0 # 数字里面非零的都为True while True: count = count + 1 print(count) 3.控制while循环的次数 count = 0 while count < 100: count = count + 1 print(count) # 打断循环的方式 1.自己修改条件 2.使用break关键字 4.break关键字 break--终止当前循环,下…
一.主要内容:1.while 循环 (难点)while 条件: 循环体 break: 直接跳出循环continue:停止当前本次循环,继续执行下一次循环.不会中断循环能让循环退出:(1)break (2)改变循环条件 2.格式化输出 %s %d f{变量名}#格式化输出例:print("我叫%s,我来自%s,我的年龄是%s,爱好是%s" % (name, address, age, like))#新版本的格式化输出例:print(f"我叫{name},我来自{address}…
Python基础篇(格式化输出,运算符,编码): 格式化输出: 格式:print ( " 内容%s" %(变量)) 字符类型: %s  替换字符串      %d 替换整体数字    %f替换浮点型 ------------ info of Alex Li -----------                          ------------ info of %s -----------  Name : Alex Li                           …
第二天课程整理 while 循环 why : while ' 循环' 的意思 what : while 无限循环 how : 1.基本结构 while + 条件 循环的代码 初识循环 while true: print('狼的诱惑')                先判断 条件 print('我们不一样')     如果是true  进行循环 print('月亮之上') 循环到底部,再次判断条件 条件成立继续循环 print('庐州月')                   print('人间'…
一.流程控制之--while 循环 循环就是重复做同一件事,它可以终止当前循环,也可以跳出这一次循环,继续下一次循环. 基本结构(基本循环) while 条件: 循环体 示例 # 这是一个模拟音乐循环播放的代码 while True: print('画') print('桥头姑娘') print('四块五的妞') 终止循环 改变条件(根据上面的流程,改变条件,就会终止循环) 可以用关键字:break,来终止循环. 调用系统命令:quit().exit() 后面会讲到,不建议大家使用. 关键字:c…
while 循环 while 条件:    循环体 循环如何终止? 改变条件. flag = Truewhile flag:    print('狼的诱惑')    print('我们不一样')    print('月亮之上')    flag = False  print('庐州月')    print('人间') ​ 1~ 100 所有的数字 count = 1 flag = True while flag: print(count) count = count + 1 if count =…
1.内容总览 while循环 格式化输出 运算符 and or not 编码的初识 2. 具体内容 while 循环 where:程序中:你需要重复之前的动作,输入用户名密码时,考虑到while循环. what:while 无限循环. how: 基本结构: while 条件: 循环体 初识循环 while True: print('狼的诱惑') print('我们不一样') print('月亮之上') print('庐州月') print('人间') 循环如何终止?--3种 改变条件. flag…
1. while循环 while 条件: 循环体(break,continue) else: 循环体(break,continue) break:彻底干掉一个循环,直接跳出. continue:停止当次循环,继续执行下一次循环. while True: content = input("你要输入的内容,输入Q退出:") if content ="" continue #如果输入为空,会执行下一次循环,接着出现 你要输入的内容: if content = "…
day02 python   一.循环: while循环     while expression:         while_suite     1.break 停止当前循环(如果多个循环嵌套, 只能跳出一层循环)     2.in     3.continue 停止本次循环之后的代码, 继续下次循环     4.else  count = 1 while count < 10:     print(count)     count += 1     if count == 5:      …