def compare_variables(var1, var2): if var1 == var2: return “We are the same” elif len(var1) == len(var2): return “We are the same length!” else: return “We are not that similar :(“
Example usage
print(compare_variables(“apple”, “apple”)) # We are the same print(compare_variables(“apple”, “peach”)) # We are not that similar :( print(compare_variables(“apple”, “grape”)) # We are the same length!
| A | B | A AND B | A OR B | A NOT | B NOT | A XOR B |
|-------|-------|---------|--------|-------|-------|---------|
| True | True | True | True | False | False | False |
| True | False | False | True | False | True | True |
| False | True | False | True | True | False | True |
| False | False | False | False | True | True | False |