+ 1

Is list in Python homogeneous?

Is list in Python homogeneous? if so then why this works perfectly fine? l=[1,2,'tr',3, (10,28), False] print(l[5])

14th Apr 2019, 4:20 AM
random moments
random moments - avatar
5 Answers
+ 2
Anil Patil That's what I'm trying to conclude I said it's not homogenous Which means it's heterogeneous In Python everything is object you can put anything inside an list and it will work fine Same thing is applicable to tuples, dictionary.
14th Apr 2019, 4:37 AM
Yugabdh
Yugabdh - avatar
+ 2
Python lists are heterogeneous. But if you use numpy arrays them you have to use same data type within an array
14th Apr 2019, 4:50 AM
Seniru
Seniru - avatar
+ 1
YUGABDH PASHTE Thank you
14th Apr 2019, 4:38 AM
Anil Patil
Anil Patil - avatar
0
Because lists are not homogeneous 🙂
14th Apr 2019, 4:30 AM
Yugabdh
Yugabdh - avatar
0
Seniru Pasan more informative
14th Apr 2019, 5:22 AM
Anil Patil
Anil Patil - avatar