Back to Browse

List in Python

2.6K views
Jul 21, 2020
30:10

What is List in Python? A list is a data structure in Python that is a mutable, or changeable, ordered sequence of elements. Each element or value that is inside of a list is called an item. Just as strings are defined as characters between quotes, lists are defined by having values between square brackets [ ].  Lists are good to use when we want to work with many connected/related values. List enable us to keep data together that belongs together, condense your code, and perform the same methods and operations on multiple values at once.  When thinking about Python lists and other data structures that are types of collections, it is useful to consider all the different collections you have on your computer: your assortment of files, your song playlists, your browser bookmarks, your emails, the collection of videos you can access on a streaming service, and more. Create an List: Eating_Foods = ['Biryani', 'Nonveg Biryani', 'Salad', 'Veg Biryani', 'Fried Rice'] print(Eating_Foods) If we want to concatenate string items in a list with other strings using the + operator: print(‘Deepak is Eating ' + Eating_Foods[0]) Modification of List: Eating_Foods[0]=‘Mango’ Slicing Lists: We can call the List with middle value and its possible and required many time while working with List Print(Eating_Foods[1:3]) Print(Eating_Foods[:4]) Print(Eating_Foods[3:]) slicing is called stride, which refers to how many items to move forward after the first item is retrieved from the list. So far, we have omitted the stride parameter, and Python defaults to the stride of 1, so that every item between two index numbers is retrieved. The syntax for this construction is list[p:q:z] There is several operation performed in List is explained in this session. #list #listinpython #python #appendinlist #pythontutorialforbeginner #pythonlistfunction *********************************************************** Did you enjoy the video? If so, give it a like above! Subscribe to our channel for more techie video 👉 https://www.youtube.com/c/DeepakRai?sub_confirmation=1 Keep Learning!! Keep Growing!! P.S. Make sure to keep up with us by clicking the bell!

Download

1 formats

Video Formats

360pmp444.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

List in Python | NatokHD