I am currently doing an assignment in which I need to read in user input separated by spaces into a list named list1. I then need to iterate over that list and all unique numbers need to be added to a different list name list2.
Finally, I need to print the numbers sorted like 1 2 3 4 5 6 with spaces.
Code
list1 = input('Enter numbers seperated by spaces: ')
list2 = []
    
for num in list1:
    if num not in list2:
        list2.append(num)
    
print(f'The distinct numbers are: {list2}') 
Here is the output that I need to fix.
Write in a string of numbers seperated by a space for each: 3 4 5 6 2
The distinct numbers are: ['3', ' ', '4', '5', '6', '2']
 
    