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 01:40
When the pc version of the spreadsheet program became available, the ibm pc quickly became the top-selling personal computer?
Answers: 3
question
Computers and Technology, 22.06.2019 08:30
Linda subscribes to a cloud service. the service provider hosts the cloud infrastructure and delivers computing resources over the internet.what cloud model is linda using
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
Aobject is used for displaying the results of a question based on stored data. a. query b. report c. table d. form
Answers: 2
question
Computers and Technology, 24.06.2019 23:00
Why is it preferable to code web pages in html format? a. to create more lines code b. to apply general formatting rules c. to display properly as search results in all browsers d. to add meaning to the document
Answers: 1
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
Health, 22.04.2021 01:00
question
Mathematics, 22.04.2021 01:00
question
Spanish, 22.04.2021 01:00
question
Mathematics, 22.04.2021 01:00
question
Mathematics, 22.04.2021 01:00
Questions on the website: 13722367