| Total Complexity | 4 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | def isometric_strings(a, b): |
||
| 2 | mappings = {} |
||
| 3 | for i, v in enumerate(a): |
||
| 4 | if v not in mappings: |
||
| 5 | mappings[v] = b[i] |
||
| 6 | else: |
||
| 7 | if mappings[v] != b[i]: |
||
| 8 | return False |
||
| 9 | return True |
||
| 10 | |||
| 11 | |||
| 12 | if __name__ == "__main__": |
||
| 13 | print("Example:") |
||
| 14 | print(isometric_strings("add", "egg")) |
||
| 15 | |||
| 16 | # These "asserts" are used for self-checking and not for an auto-testing |
||
| 17 | assert isometric_strings("add", "egg") == True |
||
| 18 | assert isometric_strings("foo", "bar") == False |
||
| 19 | assert isometric_strings("", "") == True |
||
| 20 | assert isometric_strings("all", "all") == True |
||
| 21 | assert isometric_strings("gogopy", "doodle") == False |
||
| 22 | print("Coding complete? Click 'Check' to earn cool rewards!") |
||
| 23 |