1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kenny6666 [7]
3 years ago
7

Write a python 3 function named words_in_both that takes two strings as parameters and returns a set of only those words that ap

pear 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')
Computers and Technology
2 answers:
mrs_skeptik [129]3 years ago
8 0
I was going to say the same but there is no point in writing it then
s344n2d4d5 [400]3 years ago
5 0

Answer:

def words_in_both(a, b):

 a1 = set(a.lower().split())

 b1 = set(b.lower().split())

 return a1.intersection(b1)

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

print(common_words)

Explanation:

Output:

{'all', 'of', 'jack'}

You might be interested in
A customer reports that recently several files cannot be accessed. The service technician decides to check the hard disk status
Lyrx [107]

Answer:

Back up the user data to removable disk

Explanation:

Before you work on a computer, especially anything that has to do with files not accessible, this might need to format the system because it might either be a virus or other forms of malware. Since backup was done to a different logical partition on the disk, the first thing to do before performing any diagnostic procedures on the disk is to back up the user data to a removable disk in order not to lose the information in the system.

8 0
3 years ago
Which devices are managed through device management?
mr_godi [17]
Android<span>, </span>iOS<span>, Windows and </span>Blackberry<span> devices.</span>
3 0
3 years ago
Why is it important to recognize the proper boundaries or limits of algorithms?
Oduvanchick [21]

Answer:

D

Explanation:

DDDD no war\t

4 0
3 years ago
With the help of technology students will benefit greatly from studying by themselves at home. Do you agree or disagree with the
cestrela7 [59]
I disagree because when kids are home alone, and you think they are studying they might not be and they will be playing games on the computer.
6 0
3 years ago
Read 2 more answers
A three-character code is to be assigned only if it cannot be further subdivided, and a code is __________ if it has not been co
pav-90 [236]

Answer:

Invalid are the correct answer to the following statement.

Explanation:

The following statement is correct because the following code is invalid if the code is not summarized properly according to the requirement of the following code in which the seventh character extension is included, if the three-character code is not be subdivided any more then, the following code is invalid.

5 0
3 years ago
Other questions:
  • PLEASE HELP I WILL REWARD YOU
    11·1 answer
  • Hidden costs of computers into our schools
    13·1 answer
  • A number of LC-3 instructions have an "evaluate address" step in the instruction cycle, in which a 16-bit address is constructed
    6·1 answer
  • Write a program to test the various operations of the class clockType
    8·1 answer
  • A software development company wants to reorganize its office so that managers and the Computer Programmers they supervise can b
    13·2 answers
  • 50 points please!!
    6·1 answer
  • Suppose that the following elements are added in the specified order to an empty binary search tree: Kirk, Spock, Scotty, McCoy,
    12·1 answer
  • You have two microservices that need to communicate with each other without holding up a thread on either end. One service will
    6·1 answer
  • Math and science are the foundation from which drafters work<br><br> True<br> False
    8·1 answer
  • What is the datapath of add instruction?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!