HW04
HW04
Important
The goal of this assignment is to practicing implementing functions using lists and string methods.
The homework is composed of 5 functions for you to code and execute. You have been given the
HW04.py skeleton file to fill out. Please read this PDF thoroughly as you will find more detailed in‐
formation to complete your assignment. Remember to turn in the HW04.py file as your final sub‐
mission on Gradescope.
Hidden Test Cases: In an effort to encourage debugging and writing robust code, we will be in‐
cluding hidden test cases on Gradescope for some functions. You will not be able to see the input
or output to these cases. Below is an example output from a failed hidden test case:
If the number of uppercase letters outnumber the lowercase ones, then return the string
"Darling, I need {difference} more lowercase character(s) in our love story."
If the lowercase letters outnumber the uppercase ones, then return the string "Sweetheart, I
need {difference} more uppercase character(s) in our love tale."
If both cases are equal, then return the string "Our love story is perfectly balanced,
just like us." .
Note: Consider digits, blank spaces, or special characters within the love letter to have no case.
>>> decryptValentine("!o2t67r12a!!ejkH", 3)
'Heart!'
Match Finder
Function Name: findLove()
Parameters: candidates ( list ), favCity ( str ), favColors ( list )
Returns: matches ( list )
Description: Love is in the air, and you're on a quest to find the perfect match! Write a function
called findLove() that takes in three parameters: a list of potential candidates ( list ), your fa‐
vorite city ( str ), and a list of your favorite colors ( list ). Each candidate is represented as a list
containing their name ( str ), the city they reside in ( str ), and their favorite color ( str ).
Determine and return a sorted list of the names of potential matches who share the same favorite
city with you and have a favorite color that is among your selected favorite colors.
Note: The names in the friends list correspond to the restaurant list of the same index in
friendRestaurants.
Function Points
countCase() 20
decryptValentine() 20
findLove() 20
mutualInterests() 20
galentines() 20
Total 100
Provided
The HW04.py skeleton file has been provided to you. This is the file you will edit and implement.
All instructions for what the functions should do are in this skeleton and this document.
Submission Process
For this homework, we will be using Gradescope for submissions and automatic grading. When
you submit your HW04.py file to the appropriate assignment on Gradescope, the autograder will
run automatically. The grade you see on Gradescope will be the grade you get, unless your grad‐
ing TA sees signs of you trying to defeat the system in your code. You can re-submit this assign‐
ment an unlimited number of times until the deadline; just click the “Resubmit” button at the lower
right-hand corner of Gradescope. You do not need to submit your HW04.py on Canvas.