Nice. I've seen the chained comparators with inequalities, but not equalities. Now that I see it, it's obvious that it would work. Just never thought of it before.
same_structure_as([1,'[',']'],['[',']',1]) returns True in Python 3.6 and Python 3.8 - the versions available on CW.
No reason to return anything else in other Python versions.
STDERR:
Traceback (most recent call last):
File "main.py", line 3, in
import codewars_test as test
ModuleNotFoundError: No module named 'codewars_test'
Just keep in mind the following:
Nice. I've seen the chained comparators with inequalities, but not equalities. Now that I see it, it's obvious that it would work. Just never thought of it before.
Does this map avoid recursion? If so, clever and practical idea!
Indeed that is a common pitfall.
I am surprised noone mentioned it before, thank you!
This comment is hidden because it contains spoiler information about the solution
i did not know about the global variables in python.
your solution is very interesting.
#11b3b/3qh:0z:vV
You're welcome ;-)
I had the same problem but it finally worked out. good job lechevalier,thanks, I am learning new things.
same_structure_as([1,'[',']'],['[',']',1])
returns True in Python 3.6 and Python 3.8 - the versions available on CW.No reason to return anything else in other Python versions.
Hi, the same_structure_as([1,'[',']'],['[',']',1]) results to a False when I use your solution.
Python 3.7.3
Edited
Thanks. That worked.
needs python 3.8
just hit attempt - sample tests are broken for now
Using Python 3.6 I get:
STDERR:
Traceback (most recent call last):
File "main.py", line 3, in
import codewars_test as test
ModuleNotFoundError: No module named 'codewars_test'