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
Which of these components is a part of the central processing unit (CPU) of a computer? A. memory B. storage C. control unit D.
erma4kov [3.2K]
The answer is C. control unit
8 0
3 years ago
Read 2 more answers
Under the common criteria, which term describes the user-generated specifications for security requirements?
Irina-Kira [14]

The correct answer to this question is the:

“Protection Profile (PP)”

<span>According to the ISO/IEC 15408 and the Common Criteria (CC), the Protection Profile (PP) is a document used as a part of the certification process. And since it is a generic form of a Security Target (ST), this makes it a typical creation by a user or a community of users.</span>

6 0
4 years ago
Write python code that does the following.
Mariulka [41]

Answer:

the answers are in front of you it is correct to follow the steps

¯\_(ツ)_/¯:

5 0
3 years ago
Define binary number and decimal number with example​
photoshop1234 [79]

Answer:

The Decimal Number System is a number system for which every real number x can be written in terms of the ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 as the sum of powers of 10. A number in the decimal number system is said to be of base 10 and to specify this we attach a subscript 10 to x, written (x)10.

The Binary Number System is a number system for which every real number x can be written in terms of the two digits 0 and 1 as the sum of powers of 2. A number written in the binary number system is said to be of base 2, and to specify this we attach a subscript 2 to x, written (x)2.

4 0
3 years ago
Do software engineers save millions of dollars in usa
SCORPION-xisa [38]
Yes. They make a lot of money. So eventually after saving your Money, you will make a least 1 million dollars or more.
4 0
3 years ago
Other questions:
  • Suppose that an engineer excitedly runs up to you and claims that they've implemented an algorithm that can sort n elements (e.g
    5·1 answer
  • One reason for using social media is to develop social and professional contacts. True or False?
    9·1 answer
  • ? Assessment
    10·1 answer
  • in Google, how should you phrase your search if you want to exclude a certain word from your results(for example,"chocolate")?
    14·1 answer
  • Which of the following are true about the PUSH instruction?
    9·1 answer
  • When protecting a worksheet all cells are locked by default.?
    10·1 answer
  • Write an SQL statement that uses all of the SQL built-in functions on the Quantity-OnHand column. Include meaningful column name
    14·1 answer
  • 2<br><br> What combination of keys turns the value in a cell into a percentage?
    12·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • What is keyword density?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!