I was using list comprehension in Python. But my program behaves differently based on the way how I initialize the variable
Works as expected if am using below piece of code
temp = [[-1 for y in range(k + 1)] for x in range(n + 1)]
It behaves strange if am using below code
temp = [[-1]*(k+1)]*(n + 1)
what is the difference between both the ways of initializing the variable