Programming Examples
Write a function unique to find all the unique elements of a list.
Write a
function unique to find all the unique elements of a list.
Solutiondef unique(lst):
unique_list = []
for item in lst:
if item not in unique_list:
unique_list.append(item)
return unique_list
# Main Program
list1 = [10, 20, 10, 30, 40, 20, 50, 30]
print("Original List:", list1)
print("Unique Elements:", unique(list1))
▶ RUN Output/ Explanation: