subject

1. Please fix below function to working order, run a number of tests on it so that you know it works.
The language is python 3:
An anagram is a pair of words which are the same up to a rearrangement of letters. For instance the anagrams of
"auctioned" are:
cautioned
education
Now, we're going to consider two words anagrams regardless of whether they're English words.
so happy has anagrams:
Yppah
Yahpp
Pahyp
// Funtion //
We're going to implement a function called:
def anagram_buggy(first_word, second_word):
This function should take two strings, convert them to the same case (to ignore case), and then check if they are anagrams.
Here is the code:
def anagram_buggy(first_word, second_word):
first_word = first_word. lower()
second_word = second_word. upper()
first_word_dict = {}
second_word_dict = {}
for letter in first_word:
if letter in first_word_dict:
first_word_dict[letter] += 1
for letter in second_word_dict:
if letter in second_word_dict:
second_word_dict[letter] += 1

for letter in first_word_dict:
if first_word_dict[letter] != second_word_dict[letter]:
return False

return True

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, dustysorrells74
Someone with this coz i don’t really know what i can choose, just pick whatever u want. homework - you need to choose a website that you like or use frequently. you must visit the website and discuss 6 different features/parts/aspects of the website that you think makes it good. (100 words)
Answers: 2
image
Computers and Technology, 22.06.2019 09:40, cutybrain6054
Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later date and also make it available to her colleagues
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, Lacey9319
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
image
Computers and Technology, 22.06.2019 21:50, IdkHowToDoMath
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
You know the right answer?
1. Please fix below function to working order, run a number of tests on it so that you know it works...

Questions in other subjects:

Konu
Mathematics, 22.01.2021 14:00
Konu
Mathematics, 22.01.2021 14:00
Konu
Chemistry, 22.01.2021 14:00