Python Lists | Lists in Python examples | Indexing | Nested Lists | Mutable | Negative index | CBSE

Опубликовано: 07 Январь 2025
на канале: SA Educational Hub
43
0

In this Python tutorial, we will learn: Lists in Python: An Introduction, empty list, Indexing, Negative index, Indexing Error, Type error, Lists are mutable, and Nested Lists with examples.
What is a list in Python?
A list is a value that contains multiple values in an ordered sequence.
How to create a list in Python?
A list begins with an opening square bracket and ends with a closing square bracket, [].
[‘cat’, ‘dog’, ‘horse’, ‘cow’] is an example of a list value.
Values inside the list are also called items or elements.
In a list, items are separated with commas.
What is an Indexing in list in Python?
Each item in the list can be individually accessed using its index.
An index is an integer.
An index of a list starts from 0. The first item in the list is at index 0, the second item is at index 1, the third item is at index 2, and so on.
How to access individual items in a list in Python?
We can access an item in the list by specifying its index within square brackets.
a=['cat', 'dog', 'horse','cow’]
print(a[0])
Output:
cat
What is negative index in Python?
We can also use negative integers for the index.
The integer value -1 refers to the last index in a list, the value -2 refers to the second-to-last index in a list, and so on.
What is Indexing error in Python?
Python will return an IndexError error message if you use an index that exceeds the index value in your list.
What is type error in indexing in Python?
TypeError error:
Indexes can be only integer values; floats data types will cause a TypeError error.
What is mutable in Python?
Lists are mutable. That means that the value of an item in a list can be modified with an assignment statement.
What is nested lists in Python?
Lists can also contain other list values, known as multi-dimensional lists or nested lists.
The values in these lists of lists can be accessed using multiple indexes.
Example: a[0][0]

This video is for CBSE students.
This video is for engineering students.
This video is for anyone (BCA, MCA, BTECH, BSc, MSc, PGDCA, Diploma and computer engineering students, under graduate or post graduate computer science students) who is interested in learning Python programming.
This is the best Python tutorial on YouTube.
Our video series is a Python tutorial for beginners. This video series will guide you through how to learn Python from scratch. 
I am Ambika, having 20 years of teaching experience. My mentor, friend, and guide, Situn (Anand), is a genius with an excellent academic records and is currently working on machine learning.
Please like, share and subscribe to our channel.
Thank you.
With love,
SA Educational Hub
Link to Data types in Python:
   • Data Types in Python | Numeric | Stri...  
Literals in Python:
   • Literals in Python | String Literals ...  
Errors in Python:
   • Errors in Python | Syntax Errors | Lo...  
Rvalue and Lvalue
   • Lvalue and Rvalue | Lvalue and Rvalue...  
#pythontutorial
#python
#cbse
#cbseclass11
#cbseclass12
#cbsepython
#pythonprogramming
#learnpython
#pythontutorialforbeginners
#pythonlanguage

Links to other videos:
Channel :
   / @saeducationalhub5697  
String Operations:
   • String Operations in Python | Concate...  
Indexing and Slicing in Python:
   • Indexing in Python | Slicing | Forwar...  
Pattern Programs:
   • Pattern Programs in Python | Python P...  
Summation Series:
   • Summation series in Python | Python P...  
Break and continue:
   • Break and Continue in Python | Differ...  
For loop
   • Python for loop | python range() func...  
While loop:
   • Python While Loops | while loop in Py...  
Flowchart :
   • Flowchart  | Flowchart symbols with e...  
Indentation in Python
   • Indentation in Python | Python Indent...  
Errors in Python
   • Errors in Python | Syntax Errors | Lo...  
Accepting input from user
   • Accepting input from the console in P...  
Type conversion:
   • Type conversion in Python | Implicit ...  
Data types in Python:
   • Data Types in Python | Numeric | Stri...  
Operator precedence:
   • Operator Precedence in Python | Assoc...  
Evaluation of expression:
   • Evaluation of Expressions in Python |...  
Mutable and immutable:
   • Mutable and Immutable in Python | dif...  
String data type
   • String data type in Python | String i...  
List data type in Python:
   • List data type in Python | List | Lis...  
Tuple data type in Python:
   • Tuple data type in Python | Tuple | T...  
Dictionary data type:
   • Dictionary data type in Python | Dict...  
Boolean data type
   • Boolean data type in Python | Boolean...  
Comments
   • Python Comments | Comments in Python ...  
Rvalue and Lvalue
   • Lvalue and Rvalue | Lvalue and Rvalue...  
Python variable
   • Python Variables | Variables in Pytho...  
Identity operators in Python
   • Identity operators in python | is ope...  
Operators in python
   • Operators in Python | Arithmetic | Co...  
Literals in Python:
   • Literals in Python | String Literals ...  
Introduction To Python:
   • Introduction To Python | what is pyth...  
Features of Python
   • Features of Python | Python Tutorial ...  
Install python on Android
   • How To Install Python On Android|Pyth...  
Compiler Vs Interpreter
   • compiler vs interpreter | difference ...  
Hello World in python:
   • Hello World in python | Interactive m...  
Print Vs sys.stdout.write
   • print vs sys.stdout.write in python |...  
What does print return
   • What does print () return in python |...  
Character set in Python
   • Python Character Set | Python Tokens|...  
Python Lists | Lists in Python with examples |Indexing | Nested Lists | Mutable | Negative index | CBSE | Indexing Error