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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
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
question
Mathematics, 14.04.2021 02:00
question
Mathematics, 14.04.2021 02:00
question
Mathematics, 14.04.2021 02:00
question
Mathematics, 14.04.2021 02:00
question
Social Studies, 14.04.2021 02:00
question
Social Studies, 14.04.2021 02:00
question
Mathematics, 14.04.2021 02:00
question
Mathematics, 14.04.2021 02:00
Questions on the website: 13722362