while 条件:
条件满足时,做的事情1
条件满足时,做的事情2
练习
#1.定义计数器
i = 0
#2.开始循环
while i < 3:
#循环内需要做的事情
print('hello python')
#处理计数器
i += 1

练习
while True: ###默认为True,一直循环
print('hello python')

练习
i = 0
sum = 0
while i <= 100:
sum += i
i += 1
print('0~100之间的数字求和结果为: %d' %sum)
