【发布时间】:2016-06-07 18:04:55
【问题描述】:
我怎样才能把它变成一个while循环并输出同样的东西????
for x in range(56,120) :
if (x < 57) :
summation = 0
summation = x + summation
if (x == 119) :
print (“Sum of integers from 56 to 120 is”, summation)
【问题讨论】:
-
这项任务显然是为了大揭秘
sum(range(56,120))也请记住range(x,y)真的只是去y-1
标签: python loops for-loop while-loop