import subprocess names = ["Kelly", "David", "John"] name = input("Name: ") for n in names: if name == n: print("Found") break else: command = "cowsay Not Found Moooo" subprocess.run(command, shell=True)