EliteProgrammersClub / EPCDailyChallenge

Daily challenge on algorithm, using different languages. From different problems to be solved.
MIT License
7 stars 20 forks source link

Anagram #9

Open xasterKies opened 2 years ago

xasterKies commented 2 years ago

Directions

Check to see if two provided strings are anagrams of each other. One String is an anagram of another if it uses the same character in the same quantity. Only consider characters, not spaces or punctuation. Consider capital letters in your program. Make use of Functions and Methods where necessory

You can code this with any language of your choice!

Examples

anagrams( 'rail safety' , 'fairy tales' ) -----> True anagrams( 'RAIL! SAFETY!' , 'fairy tales' ) -----> True anagrams( 'Hi there' , 'Bye there' ) -----> False

S10MC2015 commented 2 years ago

Again how do you want this commited?

import re
def anagrams(wordoneee, wordtwooo):
    wordonee = re.sub(r'[^\w\s]', '', wordoneee)
    wordtwoo = re.sub(r'[^\w\s]', '', wordtwooo)

    wordone = wordonee.lower()
    wordtwo = wordtwoo.lower()
    listwordtwo = list(wordtwo)
    lentwo = len(wordtwo)
    for i in range(0,lentwo):
        wordone = wordone.replace(listwordtwo[i],"")
    if wordone == "":
        return True
        exit()
    else:
        return False
        exit()

wordone = input("wordone ") 
wordtwo = input("wordtwo ")
print(anagrams(wordone, wordtwo))
xasterKies commented 2 years ago

Hello @S10MC2015 Checkout the ReadMe it has all instructions on how to do so!

xasterKies commented 2 years ago

Normally we are suppose to do commits rather than commenting, The ReadMe is quite explanatory

eddybruv commented 2 years ago

assign me @xaster-Kies

xxxSkypper commented 2 years ago

please assign me

mtrishal123 commented 2 years ago

Please assign me

xasterKies commented 2 years ago

done @mtrishal123