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
What would make this comparison statement False? Complete with the appropriate relational operator. "G" _____= "G"
My name is Ann [436]

Equality and Relational Operators

For the statement to return false, you can simply use the "not equal to" equality operation. The full symbol of this operation is '!=', disregarding the quotes.

<u>Examples:</u>

  • [1 != 1]  would produce FALSE. Translation: 1 <u>does not equal</u> 1?
  • [1 == 1]  would produce TRUE. Translation: 1 <u>does</u> 1?
  • ["G" != "G]  would produce <u>FALSE</u>. Translation: "G" <u>does not equal</u> "G"?

CONCLUSION: Use "!=".

8 0
2 years ago
What term best describes the grammatical rules for writing proper code? paths syntax hyperlinks declarations
Ray Of Light [21]

Answer:I believe that the most fitting answer for this question would be D., "conventions." All styles and periods of literature have their own conventions for spelling, punctuation, grammar, and capitalization. They change over the centuries and between different writers. You can also find this answer by using the process of elimination. Clarity, context, and coherence do not really have anything to do with these things. Hope this helps.

8 0
2 years ago
Read 2 more answers
What is an icon or animation used to represent a participant in an internet chat referred as?
lesantik [10]
An avatar, is the icon or animation that is used to represent a participant in an internet chat. Avatars are usually customizable to make it more 'you.'
3 0
1 year ago
Read 2 more answers
3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
Taya2010 [7]

Answer:

// program in C++ to check leap year.

// include header

#include<iostream>

using namespace std;

// main function

int main() {

// variable

  int inp_year ;

  // ask user to enter year

  cout<<"Enter year:";

  // read year

  cin>>inp_year;

  // check year is leap or not

  if (((inp_year % 4 == 0) && (inp_year % 100 != 0)) || (inp_year % 400 == 0))

  // if leap year , print leap year

     cout<<inp_year<<" is a leap year.";

  else

  // print not leap year

     cout<<inp_year<<" is not a leap year.";

  return 0;

}

Explanation:

Read year from user.Then check if year is divisible by 4 and not divisible by 100 or year is divisible by 400 then year is leap year.otherwise year is not  leap year.

Output:

Enter year:1712                                                                                                            

1712 is a leap year.

6 0
1 year ago
Read 2 more answers
Haley's employer has asked her to review tens of thousands of social media posts about their company's products and compile this
ArbitrLikvidat [17]

Answer: Variety

Explanation:

According to the given question, Haley is dealing with the variety of the organization products posts on the social media networking as Haley's employer wants to comping all the data or information related to the products into the database system.

  • The database is one of the type of management system that manages all the database that are shared by the customers or users.
  • The main important function of the database is that it organize the data more accurately and properly in the system.
  • The database management system (DBMS) handle all the data in the system more effectively from the variety of the users.

Therefore, Variety is the correct answer.

7 0
2 years ago
Other questions:
  • How did josh norman and mike keller provide coverage of katrina?
    9·2 answers
  • Graphical elements that precede each item in a list are known as​ __________.
    8·1 answer
  • Have you ever tried to teach a class full of restless, active sixth-graders? I have. I taught sixth-grade students for 12 years.
    15·1 answer
  • 8. In time series, which of the following cannot be predicted? A) large increases in demand B) technological trends C) seasonal
    11·1 answer
  • In response to a recent outbreak of computer viruses, Babbage Industries, a large technology company, installs computer virus pr
    7·2 answers
  • Match common encryption algorithms and methods with the scenarios representing real-world business applications and requirements
    14·1 answer
  • Which method allows a computer to react accordingly when it requests data from a server and the server takes too long to respond
    5·1 answer
  • We Deliver trains its truck loaders how to set the packages in the delivery vehicles, so that when delivery drivers are pulling
    15·1 answer
  • A bicycle sharing company is developing a multi-tier architecture to track the location of its bicycles during peak operating ho
    11·1 answer
  • Chinh wants to have a program print, "Sorry, but that isn’t one of your options" until the user enters the correct information.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!