5. Write a python program generate a function to filter out the repeated string in a given list, list_a.
The output is:
list_a = [2,3,4,5,6,6,4,5]
Expected Answer:
The new list: [1, 2, 3, 4, 5]
Sample Answer:
def single_list(list_a): new_list = [] for i in list_a: if i not in new_list: new_list.append(i) return new_list print("The new list:", single_list([1,2,3,3,3,3,4,5]))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)