From what I understand you want to implement a script that is able to display the value(s) whose(s) count of your occurrences is an odd number.
Well, for that we must make the following logic:
- Take the values UNREPEATED from the past list;
- Sort these values. Optional. Displays the output results in ascending order;
- Assemble an eternal object - either a list or a dictionary - containing each value together with the count of its occurrence;
- Display value(s) whose occurrence count is odd.
Following this logic, we can implement a script with list of lists or with a dictionary.
Implementation with list list:
def impares_vezes(li):
return [j[0] for j in [[i, li.count(i)] for i in sorted(set(li))] if j[1] % 2]
if __name__ == '__main__':
lista = list(map(int, input().split()))
resp = impares_vezes(lista)
print(*resp)
Dictionary implementation:
def impares_vezes(li):
return [k for k, v in {i: li.count(i) for i in sorted(set(li))}.items() if v % 2]
if __name__ == '__main__':
lista = list(map(int, input().split()))
resposta = impares_vezes(lista)
print(*resposta)
Note that when we execute the two codes, we receive the blinking cursor in the upper left corner of the screen. At this time we must type all the values of that list, in same line, separated for a single space and press Enter.
After this, the listed values will be passed as parameters to the function odd-fold(). Once there, the repeated values will be removed and ordered in an increasing order.
Subsequently, according to the script chosen, a list of lists or a dictionary containing, respectively, the said value together with the count of its occurrence.
Then another list will be mounted containing only the value(s) whose occurrence count results in an odd number.
OBS:
The last line of the code...
print(*resposta)
...is just unpacking the possible values stored in the list.