how to find palingrams python

Solutions on MaxInterview for how to find palingrams python by the best coders in the world

showing results for - "how to find palingrams python"
Kaidence
07 May 2018
1"""
2Program:
3 Python program to find anagrams in a list of strings
4"""
5from collections import Counter
6
7def get_anagrams(input_string_list, test_string): 
8   
9   print("*******************")
10   print("input_string_list = ", input_string_list)
11   print("*******************\n")
12
13   # Find the list of anagrams in the strings    
14   out_string_list = list(filter(lambda x: (Counter(test_string) == Counter(x)), input_string_list)) 
15
16   # Print the list of anagrams in the strings 
17   print("*******************")
18   print("out_string_list = ", out_string_list)
19   print("*******************\n")
20
21def Driver(): 
22   input_string_list = ['Python', 'Program', 'Machine', 'yPtnoh', 'Learning']
23   test_string = "ntoyPh"
24   get_anagrams(input_string_list, test_string)
25
26if __name__=="__main__": 
27   Driver()          # call Driver() function