String in Python 3.4 -


i have question of how return true strings. can me on how prompt user input in python 3.4 , answer question

write class/function return true if 2 input strings anagram each other. string1 anagram of string2 if string2 can obtained rearranging characters in string1.

example: string1 = 'smart' string2 = 'marts' result: true  string1 = 'secure' string2 = 'rescue'  result: true 

perhaps along lines of ( warning untested code ):

def isanagram(string1, string2):     if sorted(list(string1)) == sorted(list(string2)):         return true     else:         return false 

admittedly there more concise ways of doing particularly easy understand in view.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -