data = {'caseA': ['Printers'], 'caseB': None, 'caseC': ['Printers', 'Computers'], 'caseD': None, 'caseE': None} item = 'Printers' result = ['affected' if item in (value or ()) else 'unaffected' for value in data.values()] print(', '.join(result))of course, it could also be oneliner.
Further reading: https://docs.python.org/3/library/stdtyp...and-or-not
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs