标签:gen bsp 条件判断 else one int end 开发 停止
if else
money = 123
if money > 123:
print("OK")
else:
print("No")
if 嵌套
gender = input("??")
if gender == "男":
age = input("多大")
if int(age) > 40:
print("去隔壁")
else:
print("请")
print("激动不已")
else:
print("滚出去")
死循环
while True:
print("!@#$%^&*")
其他循环
示例1:
count = 1
while count < 10:
print("xxx")
count += 1
示例2:
while True:
content = input("请讲:")
if content == "Q":
# break # 打断的是当前本层循环, 终止掉循环
# exit(0) # 这个是彻底的退出程序。结尾print不会执行
# continue # 停止当前本次循环。 继续执行下一次循环 暂时性的
print(content)
print("去吃饭")
标签:gen bsp 条件判断 else one int end 开发 停止
原文地址:https://www.cnblogs.com/Wshile/p/12936027.html