Python实现1-100之和

def sum():
    sum = 0
    for n in range(1, 101):
        sum = sum + n
    return sum

print(sum())

 

posted @ 2020-12-17 23:18  小白菜»  阅读(419)  评论(0编辑  收藏  举报