浙大版《Python 程序设计》题目集 第2章-14 求整数段和 (15分)

A,B = map(int,input().split())
count = 0
for i in range(A,B+1):
    if count == 5:
        count=0
        print()
    print('{:>5d}'.format(i),end='')
    count +=1
print()
print('Sum = %d' % sum(range(A,B+1)))
发布了33 篇原创文章 · 获赞 0 · 访问量 266

猜你喜欢

转载自blog.csdn.net/weixin_42229583/article/details/104573109