data in lists | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

data in lists

can we put different type of data in list? e.g first node as int and second node as string

15th Jul 2019, 3:27 AM
Muhammad Faheem Nasir
Muhammad Faheem Nasir - avatar
2 Antworten
+ 6
If you are talking about python: Yes it‘s possible. list could be: lst = [] lst.append(1) lst.append([2, 3, 4]) lst.append('red') # result is: [1, [2, 3, 4], 'red']
15th Jul 2019, 5:07 AM
Lothar
Lothar - avatar
+ 3
not sure which language but yes you can... as most languages work very much alike. Here is one resource as an example of your question... https://beginnersbook.com/2013/12/linkedlist-in-java-with-example/
15th Jul 2019, 3:32 AM
BroFar
BroFar - avatar