Apr-23-2020, 02:44 AM
Why I get different format of results when I am multiplying one item of the list and the whole list?
I use triplets of numbers for RGB color coding.
When I multiply the whole list I get nicely multiplied list:
I use triplets of numbers for RGB color coding.
When I multiply the whole list I get nicely multiplied list:
bd=[(0,0,0),(255,255,255)] hg=bd*2 print(hg)
Output:[(0, 0, 0), (255, 255, 255), (0, 0, 0), (255, 255, 255)]
But when I multiply just one item from the list bd=[(0,0,0),(255,255,255)] hg=bd[0]*2 print(hg)suddenly triplets are gone and I get all output in one long list:
Output:(0, 0, 0, 0, 0, 0)