cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 196 Views

Python coding challenge - beginner

Challenge: Identify All Anagram Pairs

You are given a collection of words, for example:

words_set = {'plea', 'medical', 'listen', 'leap', 'decimal', 'silent', 'pale', 'enlist'}

 

Your task is to write a Python program that:

1.) Finds all pairs of words in words_set that are anagrams of one another.

2.) Prints each unique pair only once (i.e., ('listen', 'silent') is the same as ('silent', 'listen'), so only print one).

3.) Ensures the pair is output in a consistent order to avoid duplicates.

Use comments to explain your code so that we can get your logic!

 

Tags (3)
1 Reply
Trevor
Commander Commander
Commander
  • 118 Views

I'm going to hold off on this until: 1) someone weighs in with a response, or 2) 10 days have gone by.   I'm going to hold off because of that "beginner" stipulation!

If no one has shown up within 10 days, I've got to believe that no one is coming, at which time, I'm going to stick my nose in this pot

Trevor "Red Hat Evangelist" Chandler
Join the discussion
You must log in to join this conversation.