-1
example = str(input())
if example == ("abc") or example == ("def") or example ==("ghi"):
 print("sample")

i'd like to make it so that a bunch of keywords print a certain statement if i type in a specific word though couldn't think of a better way than this. is there a more efficient way of me writing it

Arrow
  • 11
  • You can gain a little efficiency by removing the `str()` call around `input()`, since `input()` is guaranteed to return a `str`. – Samwise Aug 18 '21 at 19:53

1 Answers1

0
if example in [ "abc", "def", "ghi" ]:
    print...
Mark Lavin
  • 870
  • 1
  • 12
  • 25