Unit Wrap-Up Assignment (Not a Deliverable):
Description: The graduates array provided in the code cell below consists of five nested tuples, each containing three elements:
- The first element of each tuple includes a fictitious 92 Number.
- The second element contains the full name of the graduate. Note that one of the graduates is named Hoshi Sato.
- The third element represents the graduation year. Note that Hoshi Sato graduated in 2019.
Objective: Utilize the array of student graduates provided in the code cell below, and write a function to retrieve and display details (the 92 number & graduation year) of a specific student. The function should accept the student’s full name as an argument and return the corresponding 92 number and graduation year.
python
1graduates=((920080361,"Suzy Greenberg", 2008),
2 (924680370, "Harpua Bulldog", 2020),
3 (921234567, "Hoshi Sato", 2019),
4 (929874554, "Scully Reed", 2025),
5 (928874563, "Travis Mayweather", 2026))- In a New Python File, define the function:
- Write a function called getIDAndYearForGraduate
- The function should take a parameter, studentName
- Implement the logic:
- Inside the body of the function, use a for loop to iterate through the graduates array.
- Within the loop, use an if statement to check if the graduate’s name matches the provided studentName.
- If the names match, return the first and third elements (the 92# and graduation year) of the matching tuple.
- Call the function:
- Call the function getIDAndYearForGraduate and pass in the argument “Hoshi Sato”.
- Print the result to the terminal.
Solution Output by calling the function with “Hoshi Sato”:
python
1(921234567, 2019)