September
ABC 373Problem 43 of 50
EasyWhat to do
Given a list of 12 words, count how many have a length equal to their position (1-indexed). The 1st word should have length 1, the 2nd length 2, etc. For example, 'september' at position 9 has length 9, so it counts.
Key Concepts
loops
if-statements
basic string manipulation
counting
Examples
Input:
words = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']
Output:
1
Input:
words = ['ve', 'inrtfa', 'npccxva', 'djiq', 'lmbkktngaovl', 'mlfiv', 'fmbvcmuxuwggfq', 'qgmtwxmb', 'jii', 'ts', 'bfxrvs', 'eqvy']
Output:
2
Tips for Beginners
- Focus on understanding the logic, not memorizing syntax
- Use print statements to debug your code
- Don't worry about input parsing - the function handles that for you
- If stuck, try writing out your solution on paper first
Python Editor
Loading Python...