0

No matter what cpu input is, it always prints "CPU FOUND"

cpu = input("CPU: ")

if cpu == "Ryzen 9 5950X" or "i9-10900K" or "i9-10900KF":
    print("CPU FOUND")
else:
    print("CPU NOT FOUND")
quamrana
  • 37,849
  • 12
  • 53
  • 71
  • 2
    It's not a problem with `else`, it's a problem with `or "some string"`. `cpu == "Ryzen 9 5950X" or "i9-10900K"` is not the same as `cpu == "Ryzen 9 5950X" or cpu == "i9-10900K"`. – Charles Duffy Aug 19 '21 at 15:40
  • you could do `if any(cpu == i for i in ["Ryzen 9 5950X", "i9-10900K", "i9-10900KF"])` – random_hooman Aug 19 '21 at 16:55

0 Answers0