Top Categories
Learn Python Episode #11: Lists (Arrays)
- Category: Information Technology
- Sub Category: Python
Get The Learn to Code Course Bundle! https://josephdelgadillo.com/product/learn-to-code-course-bundle/
In this video we are going to discuss lists and what they are in Python. So, if you have experience with programming in other languages, let's say PHP, you know to create an array, and what an arr
Get The Learn to Code Course Bundle! https://josephdelgadillo.com/product/learn-to-code-course-bundle/
In this video we are going to discuss lists and what they are in Python. So, if you have experience with programming in other languages, let's say PHP, you know to create an array, and what an array is. For those who do not have experience programming, an array is a way of keeping data organized and within a single construct. For single-dimensional arrays, we can implement it as a list in Python. To create a list in Python we use square brackets:
["Movies", "Games", "Python"]
This becomes a list that has 3 indexes. To call the first item in the list you write the following:
["Movies", "Games", "Python"][0]
Remember, when programming the first ID of the item in a list or an array will be 0. We can also concatenate a list item with a string.
print("I Like" + ["Movies", "Games", "Python"][0])
If we were to change the index to number to 1 it would print out "I Like Games". So, that is what a list is in Python. It's just a way to create a collection under one variable. In the next video we will cover dictionaries.
Web - https://josephdelgadillo.com
Subscribe - https://bit.ly/SubscribeJTD
Facebook - https://www.facebook.com/delgadillojt
Discord - https://discord.gg/EbcQFrg
Instagram - https://www.instagram.com/jo3potato