File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
- def check_anagrams (a : str , b : str ) -> bool :
1
+ """
2
+ wiki: https://en.wikipedia.org/wiki/Anagram
3
+ """
4
+
5
+
6
+ def check_anagrams (first_str : str , second_str : str ) -> bool :
2
7
"""
3
8
Two strings are anagrams if they are made of the same letters
4
9
arranged differently (ignoring the case).
5
10
>>> check_anagrams('Silent', 'Listen')
6
11
True
7
12
>>> check_anagrams('This is a string', 'Is this a string')
8
13
True
14
+ >>> check_anagrams('This is a string', 'Is this a string')
15
+ True
9
16
>>> check_anagrams('There', 'Their')
10
17
False
11
18
"""
12
- return sorted (a .lower ()) == sorted (b .lower ())
19
+ return (
20
+ "" .join (sorted (first_str .lower ())).strip ()
21
+ == "" .join (sorted (second_str .lower ())).strip ()
22
+ )
13
23
14
24
15
25
if __name__ == "__main__" :
26
+ from doctest import testmod
27
+
28
+ testmod ()
16
29
input_A = input ("Enter the first string " ).strip ()
17
30
input_B = input ("Enter the second string " ).strip ()
18
31
You can’t perform that action at this time.
0 commit comments