'''计算1+2+3+4+....+100的和? (while循环)'''u = 1sum = 0while u<=100: sum = sum + u u = u + 1print(sum)
#计算1+2+3+4+....+100的和?(for循环)v = 1sum = 0for i in range(1,101): sum = sum + v v = v + 1print(sum)