You can use the in operator. Example:
in
if operator not in ['+', '-', '*', '/']: print("Invalid Operator")
1.4m articles
1.4m replys
5 comments
57.0k users