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 will the output of this program be when it is executed? def test_function( length, width, height): print ("the area of the
erastova [34]

Answer: stuff

Explanation:

6 0
2 years ago
In this lab, you use the pseudocode in figure below to add code to a partially created Python program. When completed, college a
Elza [17]

Answer:

Python code is given below with appropriate comments

Explanation:

#Prompt the user to enter the test score and class rank.

testScore = input()

classRank = input()

#Convert test score and class rank to the integer values.

testScore = int(testScore)

classRank = int(classRank)

#If the test score is greater than or equal to 90.

if(testScore >= 90):

   #If the class rank is greater than or equal to 25,

   #then print accept message.

   if(classRank >= 25):

       print("Accept")

   

   #Otherwise, display reject message.

   else:

       print("Reject")

#Otherwise,

else:

   #If the test score is greater than or equal to 80.

   if(testScore >= 80):

       #If class rank is greater than or equal to 50,

       #then display accept message.

       if(classRank >= 50):

           print("Accept")

       

       #Otherwise, display reject message.

       else:

           print("Reject")

   

   #Otherwise,

   else:

       #If the test score is greater than or equal to

       #70.

       if(testScore >= 70):

           #If the class rank is greater than or equal

           #to 75, then display accept message.

           if(classRank >= 75):

               print("Accept")

           

           #Otherwise, display reject message.

           else:

               print("Reject")

       

       #Otherwise, display reject message.

       else:

           print("Reject")

4 0
2 years ago
Most ________ are accompanied by several common utility programs, including a search program, a storage management program, and
diamong [38]

Answer:

operating systems

Explanation:

The operating systems is shortly known as OS. It is a system software which manages the software resources of the computer, computer hardware and also provides some common services for the various computer programs.

Most of the operating systems available in the market provides some common utility programs such as the search program, a backup program and a storage management program also.

Some common operating systems are : Linux, Microsoft Windows, Ubuntu, macOS, Unix, and many more.

4 0
2 years ago
Which of the following is NOT a benefit of virtual memory? speed up of process creation increases in the effective access time o
lubasha [3.4K]

Answer:

speed up of process creation increases in the effective access time of memory

Explanation:

Virtual memories are often used in order to save up ram for other applications and not being limited by the actual physical memory that we have, in this case the virtual memory is slower than normal memories since they are not actual memories and are restricted to the spee of the connection or the speed of the disk where they are located.

8 0
2 years ago
You learned that properly edited resumes are necessary for making a good impression on a university or a potential employer. Dis
Daniel [21]

Answer:

it will not be a good impression and it will be hard to look for a job

Explanation:

3 0
2 years ago
Other questions:
  • Mark’s friends told him about an automated program that sends unsolicited messages to multiple users. Which type of program were
    11·2 answers
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). O
    5·1 answer
  • #Imagine you're writing a program to check if a person is
    8·1 answer
  • Write a program that reads an integer and displays, using asterisks a filled and hollow square, placed next to each other. for e
    9·1 answer
  • Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds o
    8·1 answer
  • 3.14 LAB: Simple statistics for Python
    7·1 answer
  • ) A byte is used to represent a single character in the computer ______<br> true or false?
    14·2 answers
  • Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" otherwise.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!