Homework 8 — University Student Records: Lists (Recursion)
Skills: 5
Due
Thursday, October 30, 2025 at 6PM (Oakland) or 9PM (Boston)
Submission
This HW, like all homeworks, is done on https://github.com and submitted on https://app.pawtograder.com. Go to Pawtograder to find the repository where the assignment should be done. Commits automatically make submissions, and feedback can be viewed on Pawtograder.
Introduction
You're working on a student information system for a university. The system uses lists to track various data about students, including their grades, course enrollments, and academic records. Throughout this assignment, you'll use recursive functions to process and analyze this student data.
DO NOT USE for each LOOPS!
Assume grades are represented as numbers (0-100), and student names are represented as strings.
Problem 1
Design a function count-until-failing that takes a list of grades and counts how many grades appear BEFORE the first failing grade (< 60). If there are no failing grades, return the total count of all grades.
Problem 2
Design a function valid-grade-sum that takes a list of grades and returns the sum of all grades, but if any grade is invalid (negative or over 100), return -1 immediately without processing the rest.
Problem 3
Design a function grades-before-target that takes a list of grades and a target grade, and returns a list of all grades that appear BEFORE the first occurrence of the target grade. If the target doesn't exist, return all grades.
Problem 4
Design a function, transform-numbers, that takes a list of numbers as input. It should return a list of numbers, where the output list starts with the same numbers as the input list, until the first 0 occurs. This 0 should NOT be included, but all numbers after it, until the end or next 0, should be included but multiplied by -1. After the second 0, no numbers should be included. If no 0s occur, then the original list should be returned.
For example, the following transformations should occur:
1,2,3,0,4,5,6,0,7,8,9 --> 1,2,3,-4,-5,-6
1,2,3,4,5,6 --> 1,2,3,4,5,6
1,2,3,0,4,5,6 --> 1,2,3,-4,-5,-6
HINT: The easiest way to design this function is to design two functions -- one that works before the first zero, and another that works after the first zero.