I\'m new to python programming. I have tried a lot to avoid these nested for loops, but no success.
My data input like: enter image description here
And my cod