[Python] Checkio Solution 解答 – Three Words

Level:

Elementary

Problem:

Let’s teach the Robots to distinguish words and numbers.

You are given a string with words and numbers separated by whitespaces (one space). The words contains only letters. You should check if the string contains three words in succession. For example, the string “start 5 one two three 7 end” contains three words in succession.

Input: A string with words.

Output: The answer as a boolean.

Precondition: The input contains words and/or numbers. There are no mixed words (letters and digits combined).
0 < len(words) < 100

 

Source: https://py.checkio.org


My Solution:


Comment:

For boolean output, that means we need to use if statement. To check every word in a list or every character in a word, we need to use for loop.