Question: Imagine that you have some data in a list that contains a lot of duplicates that you want to remove, but for simplicity s sake,
Imagine that you have some data in a list that contains a lot of duplicates that you want to remove, but for simplicitys sake, you want to avoid writing a for loop and building a new list.
Aim
The aim of this activity is to build a set out of a random set of items. Write a function called listtoset that takes a list and turns it into a set. Do not use a for loop or while loop to do so
Steps for Completion
Define the function listtoset to take an argument of a list thelist
Within the listtoset function, use another function to convert the list into a set.
Return the set.
Snippet shows an example of how the function listtoset would work using the correct function:
thelist theset listtosetthelist printtheset
Snippet
Note: The example above is only showing the logic to what the correct function used within listtoset will do
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
