def SUM(x,y):
sum=0
for i in range(x,y+1):
sum+=i
print(sum)
return sum
a=eval(input('请输入起始数值x:'))
b=eval(input('请输入起始数值y:'))
SUM(a,b)
python——定义x和y范围求它们的和
最新推荐文章于 2024-06-07 09:07:42 发布
def SUM(x,y):
sum=0
for i in range(x,y+1):
sum+=i
print(sum)
return sum
a=eval(input('请输入起始数值x:'))
b=eval(input('请输入起始数值y:'))
SUM(a,b)