Guest User

Untitled

a guest
Apr 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. "naina":"naani"
  2. print "Find anagram !\n"
  3.  
  4. def anagram():
  5. str1='naina'
  6. str2='naina'
  7.  
  8. list1=list(str1)
  9. list2=list(str2)
  10.  
  11. list1.sort()
  12. list2.sort()
  13.  
  14. print list1,list2
  15. position=0
  16. matches=True
  17.  
  18. if len(list1)==len(list2):
  19. while position < len(list1) and matches:
  20. if list1[position] == list2[position]:
  21. position =position +1
  22. else:
  23. matches =False
  24. return matches
  25. return "length is equal "
  26.  
  27. else:
  28. return "not equal"
  29.  
  30. print anagram()
Add Comment
Please, Sign In to add comment