In: Computer Science
"Python lists are power data structures. Describe some of the benefits of Python lists"
Make sure you don't just give me a list but a few sentences instead just answering it.
Python has build-in data structures
1. List
2. Dictionary
3. Tuple
4. Set
It allows to store and access data.
Lists are used to store the data of different data types . It contains index which starts from 0 to the last position this is called positive index. It even contains negative index which accesses data from the last position to the first.
Example:
list = [ ] // craeting empty list.
list = [ 1 , 2 , 3 ] // creating list with data
We can append , extend, insert and delete elements in list.
We can access the elements in the list by passing the index
print( list [ 2 ])
Functions in list
1 . len () function to find the length of the index.
2 . sort () function to sort the elements .
3 . count () function to count the number of value passed.
4 . index () function to find the index
They are used to store data of different data types. They are mutable . They store ordered collection of items.