Sometimes, we require to get the words that have Kth index with the specific letter. This kind of use case is quiet common in the places of common programming projects or competitive programming. Let’s discuss certain shorthand to deal with this problem in Python.
Method #1 : Using list comprehension +
This problem can be solved using the combination of above two functions, list comprehension performs the task of extending the logic to whole list and lower function checks for case insensitivity with the target word of argument letter.
The original list : ['Akash', 'Nikhil', 'Manjeet', 'akshat'] The list of matching Kth letter : ['Akash', 'akshat']
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course