I'd like to compare two strings in a function with the comparison/membership operators as argument.
string1 = "guybrush"
string2 = "guybrush threepwood"
def compare(operator):
print(string1 operator string2)
compare(==)
should print False
and
compare(in)
should print True
It's obviously not working like that. Could I assign variables to the operators, or how would I solve that?