filmov
tv
Working with Lists in Python - 60 Seconds to Code

Показать описание
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 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
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 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