⊗pyPmLsInr 37 of 208 menu

Lists in Python

In this lesson, we will begin to study a special data type called list. A list is a variable that can store a whole set of values ​​in an ordered form:

lst = [1, 2, 3]

Each value in the list is called a element. As you can see, the elements are separated by a comma.

A list can store different types of data: strings, numbers, booleans, and even other lists:

lst1 = ['1', '2', '3'] lst2 = [1, 2, 3] lst3 = [True, False] lst4 = [['a', 'b'], ['c', 'd']]

Also, the list can contain different types of data at the same time:

lst = [1, 'a', True] # number, string, boolean

We will look at ways to create lists in the following lessons.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline