subject

Write a python 3 function named words_in_both that takes two strings as parameters and returns a set of only those words that appear 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')

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 15:10, shancaines17
Awould be a misconfiguration of a system that allows the hacker to gain unauthorized access, whereas is a combination of the likelihood that such a misconfiguration could happen, a hacker’s exploitation of it, and the impact if the event occurred.
Answers: 3
image
Computers and Technology, 21.06.2019 18:00, markleal9484
What ordering of tcp flags makes up the three-way handshake?
Answers: 2
image
Computers and Technology, 21.06.2019 23:10, Tatertotzzzz
Write a method that accepts a string object as an argument and returns the number of words it contains. for instance, if the argument is "four score and seven years ago", the method should return the number 6. demonstrate the method in a program that asks the user to input a string and then passes that string into the method, printing out whatever the method returns.
Answers: 3
image
Computers and Technology, 23.06.2019 20:00, emmaraeschool
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
You know the right answer?
Write a python 3 function named words_in_both that takes two strings as parameters and returns a set...

Questions in other subjects:

Konu
Mathematics, 16.10.2020 17:01