#print('hello')
#input('please input enter')
i = 0
while i < 10 :
i += 1
print(i,'hello')
else:
print('over')
1 hello
2 hello
3 hello
4 hello
5 hello
6 hello
7 hello
8 hello
9 hello
10 hello
over
***Repl Closed***
# 循环语句
# 循环语句可以使指定的代码块重复指定的次数
# 循环语句分成两种,while循环 和 for循环
# while循环
# 语法:
# while 条件表达式 :
# 代码块
# else :
# 代码块
# 执行流程:
# while语句在执行时,会先对while后的条件表达式进行求值判断,
# 如果判断结果为True,则执行循环体(代码块),
# 循环体执行完毕,继续对条件表达式进行求值判断,以此类推,
# 直到判断结果为False,则循环终止,如果循环有对应的else,则执行else后的代码块
# 条件表达式恒为True的循环语句,称为死循环,它会一直运行,慎用!
# while True :
# print('hello')
# 循环的三个要件(表达式)
# 初始化表达式,通过初始化表达式初始化一个变量
# i = 0
# # 条件表达式,条件表达式用来设置循环执行的条件
# while i < 10 :
# print(i)
# # 更新表达式,修改初始化变量的值
# i += 1
# 创建一个执行十次的循环
i = 0
while i < 10 :
i += 1
print(i,'hello')
else :
print('else中的代码块')