Given
listEx = ['cat', 'dog', 'cat', 'turtle', 'apple', 'bird', 'bird']
for i in listEx:
if listEx.count(i) > 1:
print "this item appears more than once", i
else:
print "this item appears only once", i
I want it to print that cat and bird appear more than once (or just produce ['cat', 'bird']
). How can I do this?