Raktim Posted February 10, 2019 Share Posted February 10, 2019 List: collection which is ordered and changeable. But, if I create a list 'car' which is Unordered like that... car=["BMW","MAHINDRA","HERO","KTM"] print(car) SO, it does not support 'list' properties. But print result is ['BMW', 'MAHINDRA', 'HERO', 'KTM'] . Please help me that how it works even the 'list' is unordered, why it don't show any error message. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 10, 2019 Share Posted February 10, 2019 The order is the index order the Items are listed, you can insert them any order and it will always display in that same order unless sorted for example using sort(). Link to comment Share on other sites More sharing options...
Funce Posted February 10, 2019 Share Posted February 10, 2019 (edited) 12 hours ago, Raktim said: SO, it does not support 'list' properties. But print result is ['BMW', 'MAHINDRA', 'HERO', 'KTM'] . Expanding on what dsonesuk has said, a more fitting representation of this list is [ 0: 'BMW', 1: 'MAHINDRA', 2: 'HERO', 3: 'KTM' ] It is technically ordered, just not by what you think. Edited February 10, 2019 by Funce Link to comment Share on other sites More sharing options...
Raktim Posted February 11, 2019 Author Share Posted February 11, 2019 Yes, now I understand... Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now