for i in "Python":
if i =="y":
continue
print(i,end="")
输出:Pthon
跳出if条件成立
for i in "python":
if i == "t":
break
print(i,end="")
输出:py
结束循环
s = "Python"
while s != "":
for i in s:
print(i,end="")
s = s[:-1]
输出:PythonPythoPythPytPyP
s = "Python"
while s != "":
for i in s:
if i =="t":
break
print(i,end="")
s = s[:-1]
输出:PyPyPyPyPyP
s = 'python'
for i in s:
if i == 't':
continue
print(c,end="")
else:
print("正常退出")
输出:pyhon正常退出
s = 'python'
for i in s:
if i == 't':
break
print(i,end="")
else:
print("正常退出")
输出:py