Question: Write a function called remove_duplicates that takes a list of tuples and that removes duplicates from the list, returning a set of the tuples

Write a function called remove_duplicates that takes a list of tuples and

Write a function called remove_duplicates that takes a list of tuples and that removes duplicates from the list, returning a set of the tuples from the list. For example, if a list called points contains the following values: (7, 8), (7, 8), (4, 2), (4, 2)] [(1,3), (7,7), (1,3), (7,8), (1,3), (7,7), (7,8), (4, 2), then the call remove_duplicates (points) should leave the list storing: [(1, 3), (7, 7), (7, 8), (4, 2)] and the set returned should store the same values. Your function should preserve the order of values in the list (removing duplicates that come later in the list), but the values in the set can appear in any order. You may construct the set to be returned, but you are not allowed to construct other structured objects (no string, set, list, etc.).

Step by Step Solution

3.46 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!