Question: please code thsi output in Python 3 Task A ninja word is a word which hides in a sentence: it will appear continuously, but must

please code thsi output in Python 3
please code thsi output in Python 3 Task A ninja word is
a word which hides in a sentence: it will appear continuously, but
must be broken up by one or more spaces. For example, the

Task A ninja word is a word which hides in a sentence: it will appear continuously, but must be broken up by one or more spaces. For example, the word "star" is a ninja word in the phrase "best artist", but is NOT a ninja word in the phrase "twinkle twinkle little star". (Ninja words must be hidden, and thus always contain spaces). Ninja words and the sentences they appear in will always be case-insensitive. In addition, sentences may contain ninja stars (denoted with an asterisk "*"). Ninja stars can be any character, including a space. Given a list of possible ninja words, and a target sentence, return the score of the ninja words that appear in the sentence, according to the rules below. Inputs targetWords: A list of possible ninja words - eg. ["Sun", "Moon", "Star", "Planet"] sentence: A target sentence which may contain ninja words - Sentences will contain ASCII characters Aa-Zz, spaces, and asterisks - eg. Aill the stars under the sky twinkle in slo mo on a clear night" Output Determine the score of the uncovered ninja words according to the following rules: - 1 point for every ninja word found - 1 additional point for each ninja star contained in the word "nin ja" 1 point - Each ninja word should only be counted once per sentence. If a ninja word appears multiple times, only count the instance which gives the most points Example 1 - targetWords: ["Sun", "Moon", "Star", "Planet"] - sentence: "All the stars under the sky twinkle in slo mo on a clear night" - Analysis: The target sentence contains 2 ninja words: "Sun", in "stars under" "Moon", in "slo mo on" - The word "Star" is in the sentence, but it is NOT a ninja word, because it is not split up by a space. - Each ninja word is worth 1 point for a total of 2. - Return 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!