0

Python list multiplication

[4,0] * 2 : [4, 0, 4, 0] where as [4, 0] *-2 : 0 Why when a list is multipled by negative numbers gives 0. Can anyone help me to understand this clearly

24th Sep 2018, 8:18 AM
naveen kumar
naveen kumar - avatar
1 Respuesta
0
because [10:5]*-2 == [10:5]-[10:5]-[10:5] == 0
24th Sep 2018, 11:13 AM
Sousou
Sousou - avatar