Trying to compare synonyms in 2D list itself in python

Viewed 48

I have a 2D list of synonyms below: synonyms_input = [['Dg set', 'Diesel generator'], ['Organization', 'Organisation'], ['Group', 'Organization'], ['Orange', 'Kinnu'], ['Orange', 'narangi']]

I want to make the output show like below,

This output contains the same synonyms in one nested list.

The output should be: [[“Organization”, “Organisation”, “Group”], [“Dg set”, “Diesel generator”], [“Orange”, “Kinnu”, “narangi”]]

0 Answers
Related