Revisions
-
mtayseer revised this gist
Mar 24, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ import math def string_norm(s): return math.sqrt(sum(ord(c) ** 2 for c in s if c != ' ')) def anagram_detection(s1,s2): return string_norm(s1) == string_norm(s2) s1 = input("Please enter first string: ").lower() s2 = input("Please enter second string: ").lower() print ("Anagram.") if anagram_detection(s1, s2) else print ("Not Anagram.") -
mtayseer revised this gist
Mar 24, 2015 . 1 changed file with 2 additions and 7 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,12 @@ import math def stringNorm(s): return math.sqrt(sum(ord(c) ** 2 for c in s if c != ' ')) def anagram_detection(s1,s2): return stringNorm(s1) == stringNorm(s2) s1 = input("Please enter first string: ").lower() s2 = input("Please enter second string: ").lower() print ("Anagram.") if anagram_detection(s1,s2) else print ("Not Anagram.") -
aessam created this gist
Mar 24, 2015 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import math def stringNorm(s): norm = 0 for c in s: if not c==" ": norm+=math.pow(ord(c),2) return math.sqrt(norm) def anagram_detection(s1,s2): return stringNorm(s1)==stringNorm(s2) s1 = input("Please enter first string: ").lower() s2 = input("Please enter second string: ").lower() print ("Anagram.") if anagram_detection(s1,s2) else print ("Not Anagram.")