Computer Science
Answer
input_list = eval(input("Enter the list: "))
unique_values = []
for item in input_list:
if item not in unique_values:
unique_values.append(item)
print("Unique values from the list:", unique_values)
Output
Enter the list: [1, 2, 3, 3, 4, 5, 5, 6, 6, 7]
Unique values from the list: [1, 2, 3, 4, 5, 6, 7]
Related Questions
Write a Python program to append a list to the second list.
Write a Python program to generate and print a list of first and last 5 elements where the values are square of numbers between 1 and 30 (both included).
Write a Python program to convert a string to a list.
Write a Python script to concatenate the following dictionaries to create a new one:
d1 = {'A': 1, 'B': 2, 'C': 3} d2 = {'D': 4 }
Output should be:
{'A': 1, 'B': 2, 'C': 3, 'D' : 4}