variableName=[\"display\",\"screen\",\"sound\"\"audio\"] fileName=[\"PPP\", \"Abc\"] P1=\"PPP\" d=\"display\" s=\"screen\" ss=\"sound\" a=\"audio\" d=P1 loop=True def CH
If variableName is a list, you can check membership with .__contains__().
.__contains__()
Try changing the if statement to if variableName.__contains__(Up.lower):
if variableName.__contains__(Up.lower):