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
--- is a set of applications that manages the activities and resources of a computer.
hammer [34]
D. System Software 
is responsible for Manage activity 
4 0
3 years ago
HURRY MY COMPUTER IS ABOUT TO DIE ILL GIVE BRAINLYESTn
loris [4]

Answer: D, C, E, are the answers! good luck.

Explanation:

5 0
3 years ago
What basic drafting instruments are incorporated in a drafting machine?
erastovalidia [21]
It would be the army and then people of nyc
3 0
3 years ago
Can anyone answer this picture?
sasho [114]

This program multiplies integer inputs A and B, by repeatedly adding B to RESULT while decrementing A.


It will work fine when either A or B is zero. If A is zero, it will branch to QUIT immediately. If B is zero, zero will be added repeatedly to the result (which also is initialized with zero).


LOOP, RESULT etc. are called labels. They translate into a memory address location of a variable or machine instruction. But it is much more readable to have them as english words while creating your program. Also, they make your program relocatable, in the sense that while writing, you don't have to decide on which physical address your program will run.

7 0
3 years ago
Jasmine took many pictures at a photo shoot. She wants to transfer these pictures from her camera to her laptop for image enhanc
hoa [83]
The answer would more likely be A
If it’s not correct I’m very sorry
5 0
3 years ago
Other questions:
  • Why is updating your anti-virus a good thing?
    13·1 answer
  • g 18.6 [Contest 6 - 07/10] Reverse an array Reversing an array is a common task. One approach copies to a second array in revers
    8·1 answer
  • Name the contributions of Steve Jobs and Bill Gates, with respect to technology.
    5·1 answer
  • Write a 2-to-3-page research paper describing in plain language the basic purpose, theory, and implementation of GUI application
    6·1 answer
  • Write the corresponding Python assignment statements:
    13·1 answer
  • Given a string, an integer position, and an integer length, all on separate lines, output the substring from that position of th
    10·1 answer
  • How to install specific version of create-react-app so.
    10·1 answer
  • A large retail company hires several new joiners and would like to incorporate Virtual Reality (VR) into their onboarding proces
    11·1 answer
  • A related database stores data in the form of______
    15·1 answer
  • Network administrators use _____ technology when they need antivirus updates to be automatically downloaded on employees' workst
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!