Lab 4: Lists

Logistics

  • Due: Monday, June 17th no later than 5pm.
  • Submission instructions: have one partner upload your solution, entitled FirstName-LastName-Lab4.py to the BrightSpace Lab 4 Dropbox.
  • Deadline reminder: once this deadline passes, BrightSpace will no longer accept your Python submission and you will no longer be able to earn credit. Thus, if you are not able to fully complete the assignment, submit whatever you have before the deadline so that partial credit can be earned.

Learning outcomes

  • Gain experience manipulating lists.
  • Continue gaining experience using functions, iteration, and boolean expressions.

Background

In a soccer match, a win is worth 3 points, a tie is worth 1 point, and a loss is worth 0 points. Due to poor record-keeping, the MSU KickCats knows only how many games they played and the points they earned in each season, but not how many games they won, lost, or tied. They have hired you to write a program that reports the possible combinations of wins, ties, and losses for each season.

Assignment

  • Download lab4.py and rename it according to the instructions above.
  • Replace the pass construct in each function with the necessary Python code to produce this output.

Assumptions

There will always be at least one legal combination of wins, ties, and losses.

Test data

soccer_seasons = [[2, 3], [2, 4], [2, 6], [17, 17], [17, 24], [0, 0], [10, 2], [10, 3]]

Grading - 10 points

  • 2 points - the output format is matched exactly.
  • 8 points - your program will be graded using a different value for soccer_seasons. For each element that produces the correct output, you will earn 1 point.

Grading turnaround

All labs graded with scores recorded in BrightSpace no later than lab time (2pm) the following day.