My python code looks like this, arr = glob.glob('*.txt') # many files if some: arr = list(filter( lambda x : not x.endswith('3.txt'), arr )) else: arr = list(filter( lambda x : x.endswith('3.txt'), arr )) the only difference between if part and else part, former contains not. Any id…