Computers and Technology

Write a python 3 function named words_in_both that takes two strings as parameters and returns a set of only those words that appear in both strings. You can assume all characters are letters or spaces. Capitalization shouldn't matter: "to", "To", "tO", and "TO" should all count as the same word. The words in the set should be all lower-case. For example, if one string contains "To", and the other string contains "TO", then the set should contain "to". 1.Use python's set intersection operator in your code.
2.Use Python's split() function, which breaks up a string into a list of strings. For example:

sentence = 'Not the comfy chair!'
print(sentence. split())
['Not', 'the', 'comfy', 'chair!']
Here's one simple example of how words_in_both() might be used:

common_words = words_in_both("She is a jack of all trades", 'Jack was tallest of all')

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, savannahckatz
Business professionals of america, and future business leaders of america – phi beta lambda are both open to business students at which levels? check all that apply. elementary school middle school high school college
Answers: 1
image
Computers and Technology, 23.06.2019 22:30, cuki96
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
image
Computers and Technology, 24.06.2019 08:00, qveenvslayin
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
image
Computers and Technology, 24.06.2019 16:30, saadshami2384
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
Do you know the correct answer?
Write a python 3 function named words_in_both that takes two strings as parameters and returns a set...

Questions in other subjects: