Write a program to print all elements in a list those have only single occurrence.
Example: if contents of list is [7, 5, 5, 1, 6, 7, 8, 7, 6].
Your output should be:
1 8

Source Code

t = [7, 5, 5, 1, 6, 7, 8, 7, 6]

d={}
        
for value in t:
    if not value in d:
        d[value]=1
    else:
        d[value]+=1
        
for k in d:
    if d[k] == 1:
        print(k, end=" ")

Output

1 8