{}
A Python course that doesn't leave you guessing. See every step with our code visualizer.
Try it yourself!
A Python course that doesn't leave you guessing. See every step with our code visualizer.
Try it yourself!
run-icon
main.py
def removeVirus(thelist): pcfiles, actualList = thelist.split(":") actualList2 = actualList.split(",") tempList = [] for i in actualList2: morality = "Unknown" if "malware" in i: morality = "Bad" elif "antivirus" in i or "notvirus" in i: morality = "Good" elif "virus" in i: morality = "Bad" else: morality = "Good" if morality == "Good": tempList.append(i) joinedFiles = ",".join(tempList) print("PC Files: " + joinedFiles) removeVirus("PC Files: spotifysetup.exe, virus.exe, dog.jpg") # output = "PC Files: spotifysetup.exe, dog.jpg" removeVirus("PC Files: antivirus.exe, cat.pdf, lethalmalware.exe, dangerousvirus.exe ") # output = "PC Files: antivirus.exe, cat.pdf" removeVirus("PC Files: notvirus.exe, funnycat.gif") # output = "PC Files: notvirus.exe, funnycat.gif")
Output