What is List in Python | EP-16 List in Python | How to Create List in Python | Lists Functions

Subscribers:
27,900
Published on ● Video Link: https://www.youtube.com/watch?v=9Q07Z7N377Y



Duration: 21:10
181 views
8


A list is a collection of things, enclosed in [ ] and separated by commas.
The list is a sequence data type that is used to store the collection of data.
The list is mutable elements. It contains heterogenous value.
Tuples and String are other types of sequence data types.

1. using []
2. using constructor
"""
Creating a list in Python
empty list
list1 = []
print(list1)

list2 = [1,2,3]
print(list2)

list3 = ["a",1,2.5]
print(list3)

type of list
print(type(list3))

length of list
print(len(list3))
print(len(list1))

2. using constructor
list4 = list("a")
print(list4)

list5 = list(("a","b","c"))
print(list5)

my_tuple =(1,2,3)
my_list = list(my_tuple)
print(my_list)

Accessing elements from the List
"""
To access the list items refer to the index number.
Use the index operator [ ] to access an item in a list. The index must be an
integer. Nested lists are accessed using nested indexing.
"""
list6 = [1,2,3,4,5,6]
print(list6[5])
print(list6[0])

Accessing elements from a multi-dimensional list
"""
In Python, multi-dimensional lists, also known as nested lists, are lists that contain
other lists as elements.Since a multi-dimensional list is essentially a list of lists,
you access elements by using square brackets [] with nested indexes.
The first index refers to the position of the inner list (like a row in a table),
and the second index refers to the element's position within that inner list
(like a column).
"""
list7 =[[1,2,3],["a","b"]]
print(list7[0][1])
print(list7[0][2])
print(list7[1][1])
print(list7[1][0])

Negative indexing
"""
In Python, negative sequence indexes represent positions from the end of the List. Negative indexing means beginning from the end,-1 refers to the last item, -2 refers to the second-last item, etc.
"""
list8= ["c","b",1,5]
print(list8[-1])
print(list8[-2])
print(list8[-3])

Taking Input of a Python List
"""
We can take the input of a list of elements as string, integer, float, etc.
But the default one is a string.
Note:
The split() method in Python is a versatile tool for splitting a string into a
list of substrings based on a specified separator.
"""
company = input("enter the company name")
list9 = company.split()
print(list9)

#Python #PythonLists #PythonTutorials #LearnPython #CodingForBeginners #Programming #TechEducation #PythonFunctions #ProgrammingForBeginners #TechTutorials #pythonprogramming
#datatypes #beginnerpython #programmingtutorial

Connect With Us:
—————————————
➡️ Website: https://www.cybrosys.com/
➡️ Email: info@cybrosys.com
➡️ Twitter:   / cybrosys  
➡️ LinkedIn:   / cybrosys  
➡️ Facebook:   / cybrosystechnologies  
➡️ Instagram:   / cybrosystech  
➡️ Pinterest:   / cybrosys  




Other Videos By Cybrosys Technologies


2024-07-24Odoo 18 New Report Layouts & Fonts | How to Create New Report Layouts | New features in Odoo 18
2024-07-23Cloud Storage Application in Odoo 18 | Cloud Storage App in Odoo 18 | Latest Features in Odoo 18
2024-07-23Confirm & Reset Button for Selecting Multiple Companies in Odoo 18 | New Features in Odoo 18
2024-07-22What are List Operations in Python | EP-18 List Operations in Python | List Methods In Python
2024-07-22How to Scan CV Using AI in Odoo 18 | Artificial Intelligence to Scan CV | New Features in Odoo 18
2024-07-22How to Create Approval Type in Odoo 17 Approval | What are the Different Approval Types in Odoo 17
2024-07-21How to Count Records Using Search Count in Odoo 17 | Odoo 17 Development Tutorials | Search_Count()
2024-07-21How to Restore Project History in Odoo 18 | Latest Features in Odoo 18 | New Features in Odoo 18
2024-07-18How to Configure Inventory Operation Types in Odoo 17 |What are Warehouse Operation Types in Odoo 17
2024-07-18How to Take User Input in a List in Python | EP-17 Taking Integer Input in Python List | Python List
2024-07-17What is List in Python | EP-16 List in Python | How to Create List in Python | Lists Functions
2024-07-16How to Configure Re Sequence in Odoo 17 Accounting App | Odoo 17 Accounting | Functional Tutorials
2024-07-16How to Handle Missing Keys in Python Dictionaries | Ep-15 Handling Missing Keys in Dictionaries
2024-07-15How to Create a Ticket From Forum Post in Odoo 18 | New & Latest Features in Odoo 18 | Odoo 18 Forum
2024-07-15How to Create Editable Tree View in Odoo 17 | Odoo 17 Development Tutorials | Tree View in Odoo 17
2024-07-15How to Get First & Last Elements From a Tuple in Python | EP-14 Get First & Last Elements from Tuple
2024-07-14How to Create Invoice Upon Email in Odoo 17 Accounting App | Odoo 17 Functional Tutorials
2024-07-14How to Find & Print the Size of a Tuple in Python | EP-13 Find the Size of a Tuple | What is Tuple?
2024-07-11How to Create a Product in Odoo 18 POS | Odoo 18 Latest Features | Odoo 18 New & Upcoming Features
2024-07-11How to Sell Your Products in Odoo 17 Website App | Odoo 17 Website Tutorials | Functional Tutorials
2024-07-10What is Set in Python | EP-12 Sets in Python | How to Create Set in Python | Free Python Tutorials



Tags:
Python
Python Lists
Python Tutorial
Learn Python
Python Functions
How to Create List in Python
List Functions
Python Programming
Python Lists Explained
Python Basics
DataStructures
ForBeginners
LearnPython
PythonConcepts
Best Channel to Learn Programming
Python List
Python List Tutorial
Lists in Python
Python List Functions
What is a List in Python
Python List Methods
Python List Index
Python Lists Tutorial
List Functions in Python
List in Python
Data