Saturday, 13 June 2020

What is List in Python? What are the operations we can perform on List?


What is List in Python?

Lists are just like dynamic sized arrays.

Why we require List in Python? 

 

Lists need not be stored similar data types of elements always which makes it a most powerful tool in Python. A single list may contain different types of data like Float,Integers, Strings, as well as Objects. 

 

Just Try the following Code from your side and find out the answers of it.

Lists are mutable, and hence, they can be altered even after their creation.

List in Python are ordered and have a definite count. The elements in a list are indexed according to a definite sequence and the indexing of a list is done with 0 being the first index. Each element in the list has its definite place in the list, which allows duplicating of elements in the list, with each element having its own distinct place and credibility.

Note- Lists are a useful tool for preserving a sequence of data and further iterating over it.

More Function in List: 

Note: extend() simple adds the elements in existing list it doesn't make Nested list.

Next Function is insert( ) in Python


 
data structures and algorithms Web Developer

No comments:

Post a Comment