Can you help me understand how the zip function is working in this code?
I am currently learning python more in depth with a Udemy course (Python deep dive with Fred Baptiste). I am trying to solve Kata on codewar (currently kyu5 ) . Firt kata post confinement (I was very busy during this time so I had to stop learning python) I tried this one . https://www.codewars.com/kata/5946a0a64a2c5b596500019a Relatively easy to solve. But look at the best practice solution I found this one : def split_and_add(numbers, n): for _ in range(n): middle = len(numbers) // 2 left = numbers[:middle] right = numbers[middle:] numbers = [a + b for a, b in zip((len(right) - len(left)) * [0] + left, right)] if len(numbers) == 1: return numbers return numbers Could someone explain to me how this line work ? numbers = [a + b for a, b in zip((len(right) - len(left)) * [0] + left, right)]