+ 1
I don't understand the reason behind this output?
>>>My_list=[1,2,3,4] >>>My_list*-1 >>>[]
6 Answers
+ 4
There is no reason to multiplicate dictionaries, because each key in dictionary is supposed to be unique.
+ 2
Ohh. So this is the logic. Thnx Dhanush Adithya
+ 1
If you multiply a list with a positive number it'll multiply a list to n times
>>>My_list=[1,2,3,4]
>>>My_list*2
>>>[1,2,3,4,1,2,3,4]
And if you multiply a list with a number < 1it'll clear the list
>>> My_list=[1,2,3,4]
>>>My_list*0
>>>[]
+ 1
parag sahu Your welcome
+ 1
That means it will work same for dictionary , tuples also ? Dhanush Adithya
+ 1
parag sahu
It works fine with List and Tuple but not with dict