#1:打印1-100的偶数和
sum=0
# for i in range(1,101):
# if i%2==0:
# sum1+=i
for i in range(2,101,2):
sum += i
print(sum)
#2:打印杨辉三角
for i in range(6):
for j in range(i):
print("* ",end='')
print("\n")
Python:02打印1-100的偶数和&&杨辉三角(if循环语句)
最新推荐文章于 2023-06-11 16:02:43 发布