15 Aug
2019
15 Aug
'19
9:08 a.m.
Hello I'm Vinay recently I started learning python and in this process, I noticed there is a glitch in tuples. I don't know whether it's a glitch or not but what I noticed is a list containing single list can identify inner list as a single element of the list whereas in tuples a tuple containing single tuple is unable to identify as a single element unless a comma is specified. # in case of lists a = [[1,2,3]] for i in a: print(i) # this outputs [1,2,3] # in case of tuples a = ((1,2,3)) for i in a: print(i) # outputs as 1 2 3 # but if we specify comma a = ((1,2,3),) for i in a: print(i) # this outputs (1,2,3)