python中的循环函数有以下两种
1.for循环
sum = 0for x in range(5):sum = sum + xprint(sum)
sum = 0
for x in range(5):
sum = sum + x
print(sum)
2.while循环
sum = 0n = 1while n < 5:sum = sum + nn = n+1print(sum)
n = 1
while n < 5:
sum = sum + n
n = n+1