⊗pyPmLsSBC 38 of 208 menu

Creating Lists Using Square Brackets in Python

The simplest way to create lists is to use square brackets:

lst = []

Inside these brackets we can write the elements we need. Let's fill our list with numbers:

lst = [1, 2, 3, 4]

Create a list and fill it with the strings 'ab', 'cd', 'ef'.

Create a list of the names of the days of the week.

Add to the list created in the previous task the numbers corresponding to the days of the week.

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