"""File: recursive_sum.py Purpose: Find the sum of the first n positive integers using recursion Run: python recursive_sum.py Input: A positive int n Output: The sum of the first n positive integers """ def rsum(val): """ Use recursion to find the sum 1 + 2 + . . . + val""" if val == 1: return val else: sum = val + rsum(val-1) return sum val = int(raw_input("Enter a whole number >= 1\n ")) sum = rsum(val) print "The sum of the first", val, "whole numbers is", sum