1到100累加计算python脚本:

vi a1.py

#!/usr/bin/python

def sum(): sum = 0 for i in range(1,101): sum = sum + i return sum print sum() :wq

python a1.py