Algorithms

Your Assignment

Write a recursive function sumlist(my_list) to calculate the sum of the numbers in a list my_list passed as a parameter. The sum of a list is the sum of the head (first element) plus the sum of the tail (all the other elements). Test your function by creating a program that uses sumlist to calculate and print the sum of the following list:

my_list = [7, 5, 4, 27, 52, 42, 13, 17]

This is a easy assignment the requires the use of recursion to solve.

Submission Requirements

Your file is required to be named lab_algorithms.py.

Please read and follow the Submission Requirements to avoid point deductions specified below.

Grading

The following is the grading rubric for this lab to be used by the course graders. The lab is worth 100 points.

Note: There may be additional criteria for grading, this is just a summary of the major rubric items.

Grading Rubric
Type Description Point Loss (Max)
  [General]  
SyntaxError Exceptions A program that doesn’t even start due to syntax errors. -30
Docstrings Missing proper lab header (e.g. no name, lab section, etc) -10
main() Your program should have main() as the first-called function -10
PEP 8 Style Egregious problems with your code styling -10
Incorrect Filename Follow the submission instructions -5
Commenting Insufficient or excessive comments -5
  [Lab Specific]  
Recursion Any reasonable variation of my solutions should get full credit; however the program must use recursion. -100