def findRecommendations (matches): Specific Restrictions (in addition to the general restrictions above): o You are only allowed .clear(), .append(), len(), range(), .insert(), .extend() o You may not use sets or dictionaries Description: Given a one-dimensional list of dating app matches which contain information in this order [Initials, Gender, Compatibility Score], build a 2D list containing only the matches with a compatibility score of 80 or higher. Include a heart shape for the one match on the list with the highest score. You can append a heart shape to a list by typing .append("\u2665"). Parameters: matches is a 1D list of variable size containing match information in this order [Initials (string), Gender (string), Compatibility Score (int)]. Return value: None. The list matches is modified in place, and after modification, it is a list of lists. Returning a new list will not work, you must make updates to the matches list. Hint: feel free to make a deep copy of matches, prior to modifying it. Assumptions: All input values are valid. The parameter matches will never be empty. There is only one match with the highest score (no duplicate highest scores). Examples: matches = ["JS", "M", 90, "MS", "M", 76, "JB", "M", 89, "TM", "M", 79] find Recommendations(matches) print(matches) matches = ["JS", "M", 90, "MS", "F", 76, "JB", "M", 89, "TM", "F", 79, "GM", "M", 100, "AB", "F", 65, "SK", "F", 88] find Recommendations(matches) #nothing is returned! print(matches) #[['US', 'M', 90], ['JB', 'M', 89], [GM', 'M', 100,'], ['SK', 'F', 88]] matches = ["JS", "M", 50, "MS", "F", 46, "JB", "M", 68, "TM", "F", 50, "GM", "M", 30, "SK", "F", 33] find Recommendations(matches) #nothing is returned! #] Empty list because no matches with compatibility score 80 or higher #nothing is returned! [['US', 'M', 90,'], ['JB', 'M', 89]] print(matches) Explanation: Every third item on the given list is the compatibility score, so we loop through each item in the list specifically targeting this value and compare to see if the value is greater than or equal to 80; if it is, we then take that information and make a sublist, which we then append to our main list; creating our list of lists. Once we have our list of lists of matches with high compatibility scores, we search for the one sublist that contains the highest compatibility score, once found, we append the heart shape to that sublist.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

in python please

Background
Loop statements allow us to run the same block of code repeatedly, with the chance to use
different values for variables each time as the accumulated effects pile up. Lists are sequences
that can be inspected value-by-value and modified at will. In this PROGRAMMING we will use
loops to perform calculations or adjustments on lists and multidimensional lists. We will also
explore other sequences such as sets and dictionaries.
General Restrictions
•
You are not allowed to import anything
•
You are not allowed to use slicing
•
You are not allowed to use any string methods
• Please pay attention to specific restrictions written in for each individual function below
• Don't forget to comment the code
• No hard coding!
Transcribed Image Text:Background Loop statements allow us to run the same block of code repeatedly, with the chance to use different values for variables each time as the accumulated effects pile up. Lists are sequences that can be inspected value-by-value and modified at will. In this PROGRAMMING we will use loops to perform calculations or adjustments on lists and multidimensional lists. We will also explore other sequences such as sets and dictionaries. General Restrictions • You are not allowed to import anything • You are not allowed to use slicing • You are not allowed to use any string methods • Please pay attention to specific restrictions written in for each individual function below • Don't forget to comment the code • No hard coding!
Functions
The signature of each function is provided below, do not make any changes to them. Make sure
there are no input() or print() statements in your code
Backstory: You work for a dating app company; you were hired to write some code to help the
app function better.
The following are the functions you must implement:
def findRecommendations (matches):
Specific Restrictions (in addition to the general restrictions above):
o You are only allowed .clear(), .append(), len(), range(), .insert(), .extend()
o You may not use sets or dictionaries
Description: Given a one-dimensional list of dating app matches which contain information in this
order [Initials, Gender, Compatibility Score], build a 2D list containing only the matches with a
compatibility score of 80 or higher. Include a heart shape for the one match on the list with the
highest score. You can append a heart shape to a list by typing .append("\u2665").
Parameters: matches is a 1D list of variable size containing match information in this order
[Initials (string), Gender (string), Compatibility Score (int)].
Return value: None. The list matches is modified in place, and after modification, it is a list of lists.
Returning a new list will not work, you must make updates to the matches list. Hint: feel free to
make a deep copy of matches, prior to modifying it.
Assumptions: All input values are valid. The parameter matches will never be empty. There is only
one match with the highest score (no duplicate highest scores).
Examples:
matches = ["JS", "M", 90, "MS", "M", 76, "JB", "M", 89, "TM", "M", 79]
find Recommendations(matches)
print(matches)
matches = ["JS", "M", 90, "MS", "F", 76, "JB", "M", 89, "TM", "F", 79, "GM", "M", 100, "AB", "F", 65, "SK", "F", 88]
find Recommendations(matches)
#nothing is returned!
#[['US', 'M', 90], ['JB', 'M', 89], ['GM', 'M', 100, ''], ['SK', 'F', 88]]
#nothing is returned!
#[['US', 'M', 90, '], ['JB', 'M', 89]]
print(matches)
matches = ["JS", "M", 50, "MS", "F", 46, "JB", "M", 68, "TM", "F", 50, "GM", "M", 30, "SK", "F", 33]
find Recommendations(matches)
#nothing is returned!
#] Empty list because no matches with compatibility score 80 or higher
print(matches)
Explanation:
Every third item on the given list is the compatibility score, so we loop through each item in the list specifically targeting this value and
compare to see if the value is greater than or equal to 80; if it is, we then take that information and make a sublist, which we then append
to our main list; creating our list of lists. Once we have our list of lists of matches with high compatibility scores, we search for the one
sublist that contains the highest compatibility score, once found, we append the heart shape to that sublist.
Transcribed Image Text:Functions The signature of each function is provided below, do not make any changes to them. Make sure there are no input() or print() statements in your code Backstory: You work for a dating app company; you were hired to write some code to help the app function better. The following are the functions you must implement: def findRecommendations (matches): Specific Restrictions (in addition to the general restrictions above): o You are only allowed .clear(), .append(), len(), range(), .insert(), .extend() o You may not use sets or dictionaries Description: Given a one-dimensional list of dating app matches which contain information in this order [Initials, Gender, Compatibility Score], build a 2D list containing only the matches with a compatibility score of 80 or higher. Include a heart shape for the one match on the list with the highest score. You can append a heart shape to a list by typing .append("\u2665"). Parameters: matches is a 1D list of variable size containing match information in this order [Initials (string), Gender (string), Compatibility Score (int)]. Return value: None. The list matches is modified in place, and after modification, it is a list of lists. Returning a new list will not work, you must make updates to the matches list. Hint: feel free to make a deep copy of matches, prior to modifying it. Assumptions: All input values are valid. The parameter matches will never be empty. There is only one match with the highest score (no duplicate highest scores). Examples: matches = ["JS", "M", 90, "MS", "M", 76, "JB", "M", 89, "TM", "M", 79] find Recommendations(matches) print(matches) matches = ["JS", "M", 90, "MS", "F", 76, "JB", "M", 89, "TM", "F", 79, "GM", "M", 100, "AB", "F", 65, "SK", "F", 88] find Recommendations(matches) #nothing is returned! #[['US', 'M', 90], ['JB', 'M', 89], ['GM', 'M', 100, ''], ['SK', 'F', 88]] #nothing is returned! #[['US', 'M', 90, '], ['JB', 'M', 89]] print(matches) matches = ["JS", "M", 50, "MS", "F", 46, "JB", "M", 68, "TM", "F", 50, "GM", "M", 30, "SK", "F", 33] find Recommendations(matches) #nothing is returned! #] Empty list because no matches with compatibility score 80 or higher print(matches) Explanation: Every third item on the given list is the compatibility score, so we loop through each item in the list specifically targeting this value and compare to see if the value is greater than or equal to 80; if it is, we then take that information and make a sublist, which we then append to our main list; creating our list of lists. Once we have our list of lists of matches with high compatibility scores, we search for the one sublist that contains the highest compatibility score, once found, we append the heart shape to that sublist.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education