Suppose i have a list in python which contains many words. Now I want to print elements in list on basis of a condition, which I have to take from input. For example, I want all elements which start with 'a' sometimes, or elements which end with 'l'.
So, I want an applicable method to execute this programme :
a=['','apple','ball','cat']
condition = input()
for i in a :
if condition:
print i
where condition is an expression and I need programme to parse it as a expression instead of string.