you got a list of strings. print only the string which have an "e" at index(1) or strings which have an odd number of characters in python
You can use list comprehension to achieve that. Here's the code:
main.py
lst = ['hello', 'world', 'thanks', 'for', 'help']
# print strings which have an "e" at index(1)print([s for s in lst iflen(s) > 1and s[1] == 'e'])
# print strings which have an odd number of charactersprint([s for s in lst iflen(s) % 2 != 0])