python1+..+100
# -*- coding: cp936 -*-
y = "yes"
while y == "yes":
print "please input num"
a = input()
print "please input endnum"
c = input()
b=a+1
while b<=c:
a=a+b
b=b+1
print '答案为:' ; print a
#y = "no" #取消“#”就是控制循环
print "go on!? (yes or no):"
#y = raw_input() #把输入结果作为字符串给予变量y
转载于:https://blog.51cto.com/yangyy/1878712
本文介绍了一个使用Python编写的简单程序,该程序可以接收用户输入的两个整数,并计算从第一个整数到第二个整数之间的所有整数之和。通过一个循环结构实现,程序还允许用户多次执行计算直至选择停止。

1707

被折叠的 条评论
为什么被折叠?



