Working with Lists in Python - 60 Seconds to Code

Published: 09 March 2020
on channel: Faisal Akhtar
25
1

Welcome to 60 seconds to code where I show you how to code in 60 seconds or less.
Today you will learn about another datatype in python called a list.
You can think of a list is a collection of items. A list can contain any python object or datatype.
Step 1 – Create a new file called lists.py
Step 2 – In the first line write cars = [‘Corolla’,’Carmy’,’Prius’]
Step 3 – In the second line write print(cars)
Step 4 – To access an element in the list, in the third line type print(cars[0]).
Remember, programmers always count starting from 0 so 0 is actually the first element in the list.
Step 5 – Save and then run the file from the terminal
Congratulations, you’ve learned how to create a list and access a single element in a list.
Try to code a little every day because CODE IS LIFE
#tutorial on #howto create a list and access its elements in your #python program. #60secondstocode #codeislife


On this page of the site you can watch the video online Working with Lists in Python - 60 Seconds to Code with a duration of hours minute second in good quality, which was uploaded by the user Faisal Akhtar 09 March 2020, share the link with friends and acquaintances, this video has already been watched 25 times on youtube and it was liked by 1 viewers. Enjoy your viewing!