How can we remove duplicate months and years from python list? Here's my code it's not working fine. I can't think of any solution.
a = ['26/09/2021', '29/09/2021','26/07/2021', '29/07/2021','26/07/2021', '29/09/2021','26/07/2022', '29/09/2022']
def rdm(l):
l = sorted(list(set(l)))
for i in l:
print("/".join(i.split('/')[1:3]))
rdm(a)
Output :
07/2021
07/2022
09/2021
07/2021
09/2021
09/2022
Required output:
07/2021
07/2022
09/2021
09/2022