python 循环练习
# 1.用循环实现下列计算:
#
# 打印出1-100中所有奇数;
# for i in range(1,101,2):
# print(i)
# count = 1
# while count<=100 :
# print(count)
# count+=2
# 计算1-100之间所有整数的和;
# sum = 0
# for i in range(1,101):
# sum = sum + i
# print(sum)
# sum = 0
# count = 0
# while count<=100:
# sum = sum + count
# count +=1
# print(sum)
# 计算1-100之间所有奇数的和;
# sum = 0
# for i in range(1,101,2):
# sum = sum + i
# print(sum)
# sum=0
# count = 1
# while count<=100 :
# sum=sum+count
python 循环练习最先出现在Python成神之路。
共有 0 条评论