def sum (no): if (no == 1): return 1 else: return (no + sum(no-1) ) def main (): lastNumber = input ("Enter the last number in the series: ") total = sum (lastNumber) print "The sum of the series from 1 to", lastNumber, "is", total main ()