answer.
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]
2 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]2 years ago
8 0
I was going to say the same but there is no point in writing it then
s344n2d4d5 [400]2 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
Poor quality lateral communication will result in which ofthe
zhuklara [117]

Answer:

b

Explanation:

b, lack of coordination

3 0
2 years ago
Read 2 more answers
A company has a number of employees. The attributes of EMPLOYEE include Employee ID (identifier), Name, Address, and Birthdate.
IgorLugansk [536]

Answer:

The ERD is attached.

Explanation:

See the attached document for ERD

Download docx
4 0
2 years ago
Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
JulsSmile [24]

Answer:

def max_magnitude(user_val1, user_val2):

if abs(user_val1) > abs(user_val2):

return user_val1

else:

return user_val2

if __name__ == '__main__':

n1 = int(input("Enter the first integer number: "))

n2 = int(input("Enter the second integer number: "))

print("The largest magnitude value of", n1, "and", n2, "is", max_magnitude(n1, n2))

Explanation:

5 0
2 years ago
Which process is used to protect transmitted data in a vpn?
wlad13 [49]
Here is the answer: <span>Tunneling</span>
3 0
2 years ago
Which of the following Power BI tools is best suited for editing data before import?
nikdorinn [45]

Answer:

C.)Power query editor

Explanation:

Power Query Editor is a tool in MS Excel 2010 which allows the user to locate, edit and load external data before importing it.

It imports data from different sources, joins, appends data and shapes data according to requirements.

8 0
1 year ago
Other questions:
  • your monthly living expenses are $1500 on an income of $1,650 per month. your goal is to have an emergency fund of 4 times your
    5·1 answer
  • ____ refers to typing your entire e-mail message or discussion group post using only capital letters.
    15·1 answer
  • Which presenter would most likely benefit from a custom slide show?
    10·2 answers
  • Suppose that you need to maintain a collection of data whose contents are fixed- i.e., you need to search for and retrieve exist
    8·1 answer
  • A company moves a popular website to a new web host. Which of the following will change as a result?
    15·1 answer
  • Megan has written the following rough draft for her assignment. Choose the correct way to complete each sentence. Sarah is creat
    13·1 answer
  • In this image, which feature did we most likely use to quickly change the background, fonts, and layout?
    6·1 answer
  • Which group contains the command to manually conduct a spell check ?
    9·1 answer
  • The dealer's cost of a car is 85% of the listed price. The dealer would accept any offer that is at least $500 over the dealer's
    7·1 answer
  • A large gambling company needs to be able to accept high volumes of customer wagers within short timeframes for high-profile spo
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!