Question: Write a functioncleaned(L)to create a new list formed by all unique items of L (removing duplicates). This function could be written without the continue statement
Write a functioncleaned(L)to create a new list formed by all unique items of L (removing duplicates).
This function could be written without the continue statement and it would be prettier, but use the continue statement just this once for training purposes.
Use the docstring """Creates a new list of unique items from L""".
Do not change the main program. Expected output:
|
['d', 'b', 'c', 'a'] |
# Main program (do not change): letters = ['d', 'b', 'c', 'a', 'd', 'a', 'b', 'c', 'a', 'c'] letters2 = cleaned(letters) print(letters2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
