I tried implementing the following JS code in Python but I am having issues while using the map function. I am unable to get the desired output. I have attached the working JavaScript implementation of the code and my Python implementation (which is not working).
This image contains the working JS implementation
Refer below for my python implementation.
Here is my python implementation
I feel I have messed up the map function in line 8.