while 循环初认识

#!/usr/bin/env python
#-*- coding:utf-8 -*-

num=0
while num<=10:
    print(num,end="\t")
    num +=1
print("**************************")

num2=0
sum_all=0
while num2<=100:
    sum_all=sum_all+num2
    num2+=1
print("1-100累加和:",sum_all)

 

posted @ 2021-04-21 22:07  614_四爷  阅读(37)  评论(0编辑  收藏  举报