So I'm a beginner in python and I'm doing a task that needed me to count how many items in a list, count each item and put it into dictionary. At the end I did managed to make the program work but I don't understand why this code doesn't work
def stringinlist(*strings):
dictionary = {}
count = 0
for objects in strings:
if objects in dictionary == False:
for check in strings:
if objects == check:
count += 1
dictionary[objects] = count
count = 0
return dictionary
print(stringinlist("yo","hello","hello","yo"))
I tried to debug and saw that the "if objects in dictionary.." doesn't work even when its supposed to return False any explanation?