def increment_list(nums):
    i = 0
    while i < len(nums):
        nums[i] = nums[i] + 1
        i = i + 1

def append_sum(nums): sum = 0 for i in nums: sum = sum + i nums.append(sum)
def main(): nums = [1] for i in range(4): increment_list(nums) append_sum(nums) print(nums)
main()