#!/usr/bin/env python
# coding: utf-8
# # Validate Anagrams using Python
# In[4]:
def anagram(word1, word2):
word1 = word1.lower()
word2 = word2.lower()
return sorted(word1) == sorted(word2)
print(anagram("cinema", "iceman"))
print(anagram("cool", "loco"))
print(anagram("men", "women"))
print(anagram("python", "pythno"))
#clcoding.com
# In[ ]:
0 Comments:
Post a Comment