You can either set up your Python environment or use an online interpreter like www.online-python.com. Q01. How will you remove duplicates from a list?
|
1 2 3 |
input = ["a", "b", "a", "c", "c"] |
A01. You can add it to a dictionary to remove the duplicates as shown below:
|
1 2 3 4 5 |
input = ["a", "b", "a", "c", "c"] output = list(dict.fromkeys(input)) print(output) |
Outputs:
|
1 2 3 |
['a', 'b', 'c'] |
Q02. … Read more ›...