SlideShare a Scribd company logo
2
Most read
3
Most read
7
Most read
[DECLARATION AND INTIALIZATION OF LIST]
COMPUTER SCIENCE(083)
CLASS: XII
LIST IN PYTHON
PART-1
What is List?
How we declare a List?
How we initialize a List?
Different methods of initializing list.
WHAT IS LIST:
A list is a collection of values or an ordered sequence of values.
Values in the list can be
Elements of a list enclosed in a square brackets [ ], separated by
commas (,) .
Syntax:
list_name= [value1, value2,……..,valueN]
Example:
No_list = [ 10, 20, 30, 40, 50 ]
HOW TO CREATE AND INITIALIZE LIST
Method 1: If list is declare empty.
list1=[ ]
Method 2: Initialize list with value:
If we want to store the numbers in a list.
list2= [10, 20, 30, 40, 50]
If we want to store the words or string in a list.
list3= [“Mango”, “Apple”,”Grapes”,”Oranges”]
HOW TO CREATE AND INITIALIZE LIST
If we want to store the characters in a list.
list4= [‘A’,’E’,’I’,’O’,’U’]
If we want to store the mixed information in a list.
list4= [“Kapil”, 13,”Class-IX”, 40]
TO DISPLAY THE LIST
Example:
list2= [10, 20, 30, 40, 50]
print(list2)
----------------Output-------------
[10, 20, 30, 40, 50]
Example:
list3= [“Mango”, “Apple”,”Grapes”,”Oranges”]
print(list3)
----------------Output-------------
[‘Mango’, ‘Apple’, ’Grapes’, ’Oranges’]
HOW TO CREATE AND INITIALIZE THE
LIST USING LIST() CONSTRUCTOR
Syntax:
list_name=list(sequence or string)
Example:
list1=list(‘Computer’)
print(list1)
----------output----------
[‘C’,’o’,’m’,’p’,’u’,’t’,’e’,’r’]
If we want to store the characters in a list.
list4= list((‘A’,’E’,’I’,’O’,’U’))
---------Output----------
[‘A’, ‘E’,’I’,’O’,’U’]
HOW TO CREATE AND INITIALIZE THE
LIST USING LIST() CONSTRUCTOR
Example:
If we want to store the mixed information in a list.
list4= list((“Kapil”, 13,”Class-IX”, 40))
----------------Output-------------
[‘Kapil’, 13,’Class-IX’, 40]
Example: If we want to store the numbers in a list.
List_=list((10, 20, 30, 40, 50))
----------------Output-------------
[10, 20, 30, 40, 50]
HOW USER ENTER THE VALUES IN A LIST
AT RUN TIME
Using input() function how we can enter the number inside the list.
If we want to enter number 1,2,3,4,5,6,7,8,9 using keyboard at the
run time
Example:
no=list(input(“Enter the no”))
print(no)
-----------Output-------------
[‘1’,’2’,’3’,’4’,’5’,’6’,’7’,’8’,’9’]
These numbers are store in a character format as these numbers
are display in ‘1’ format.
We can use eval( ) method, which identifies the data type and
evaluate them automatically.
Example:
no=eval(input(“Enter the no:”))
print(no)
-------Input-----------
Enter the no: [1,2,3,4,5,6,7,8,9]
-----------Output-------------
[1,2,3,4,5,6,7,8,9]
-------Input-----------
Enter the no: 1,2,3,4,5,6,7,8,9
-----------Output-------------
(1,2,3,4,5,6,7,8,9)
If you enter the number with square
brackets it will create List
If you enter the number without
square brackets it will create tuple

More Related Content

What's hot (20)

PPT
Stack application
Student
 
PDF
Python Variable Types, List, Tuple, Dictionary
Soba Arjun
 
PDF
Queue as data_structure
eShikshak
 
PPTX
Unit 4 python -list methods
narmadhakin
 
PDF
9 python data structure-2
Prof. Dr. K. Adisesha
 
PPT
09 Managing Dependencies
rehaniltifat
 
PPTX
Python Programming Essentials - M12 - Lists
P3 InfoTech Solutions Pvt. Ltd.
 
PDF
Python Regular Expressions
BMS Institute of Technology and Management
 
PPTX
SQL - DML and DDL Commands
Shrija Madhu
 
PPTX
Packages In Python Tutorial
Simplilearn
 
PPT
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
PDF
Function in Python
Yashdev Hada
 
PPTX
Python-List.pptx
AnitaDevi158873
 
PPTX
Binary Search Tree in Data Structure
Dharita Chokshi
 
PPTX
Sql operator
Pooja Dixit
 
PPTX
Queue in Data Structure
Janki Shah
 
DOC
3963066 pl-sql-notes-only
Ashwin Kumar
 
PPSX
python Function
Ronak Rathi
 
PDF
What is Dictionary In Python? Python Dictionary Tutorial | Edureka
Edureka!
 
Stack application
Student
 
Python Variable Types, List, Tuple, Dictionary
Soba Arjun
 
Queue as data_structure
eShikshak
 
Unit 4 python -list methods
narmadhakin
 
9 python data structure-2
Prof. Dr. K. Adisesha
 
09 Managing Dependencies
rehaniltifat
 
Python Programming Essentials - M12 - Lists
P3 InfoTech Solutions Pvt. Ltd.
 
Python Regular Expressions
BMS Institute of Technology and Management
 
SQL - DML and DDL Commands
Shrija Madhu
 
Packages In Python Tutorial
Simplilearn
 
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
Function in Python
Yashdev Hada
 
Python-List.pptx
AnitaDevi158873
 
Binary Search Tree in Data Structure
Dharita Chokshi
 
Sql operator
Pooja Dixit
 
Queue in Data Structure
Janki Shah
 
3963066 pl-sql-notes-only
Ashwin Kumar
 
python Function
Ronak Rathi
 
What is Dictionary In Python? Python Dictionary Tutorial | Edureka
Edureka!
 

Similar to LIST IN PYTHON (20)

PPTX
List In Python Programming. The linked list
bestbuddiesofgcs
 
PPTX
Python _dataStructures_ List, Tuples, its functions
VidhyaB10
 
PDF
List,tuple,dictionary
nitamhaske
 
PPTX
Pythonlearn-08-Lists.pptx
MihirDatir1
 
PPTX
list.pptx
SwapnaliGawali5
 
PDF
Data type list_methods_in_python
deepalishinkar1
 
DOCX
List Data Structure.docx
manohar25689
 
PPTX
Part 2 - Python Tutorial | Introduction to Lists
Shivam Mitra
 
PDF
Python_Lists_. Full_Presentation.pdf
sukeerthankoyyada
 
PPTX
powerpoint 2-13.pptx
JuanPicasso7
 
PDF
beginners_python_cheat_sheet -python cheat sheet description
NaveenVarma Chintalapati
 
PPTX
PYTHON-PROGRAMMING-UNIT-III.pptx kghbg kfhjf jruufg jtuuf
DeepakRattan3
 
PPTX
listtupledictionary-2001okdhfuihcasbdjj02082611.pptx
meganathan162007
 
PPTX
Lecture2.pptx
Sakith1
 
PPTX
Pythonlearn-08-Lists.pptx
MihirDatir
 
PPTX
listppt.pptx h4wtgesvzdfvgsrbyhrrtgsvefcdef
rajpalyadav13052024
 
PPTX
IPP-M2-C1-Lists-Data Types.pptx for project management
tahir843188
 
PPTX
Module-2.pptx
GaganRaj28
 
PDF
Module III.pdf
R.K.College of engg & Tech
 
List In Python Programming. The linked list
bestbuddiesofgcs
 
Python _dataStructures_ List, Tuples, its functions
VidhyaB10
 
List,tuple,dictionary
nitamhaske
 
Pythonlearn-08-Lists.pptx
MihirDatir1
 
list.pptx
SwapnaliGawali5
 
Data type list_methods_in_python
deepalishinkar1
 
List Data Structure.docx
manohar25689
 
Part 2 - Python Tutorial | Introduction to Lists
Shivam Mitra
 
Python_Lists_. Full_Presentation.pdf
sukeerthankoyyada
 
powerpoint 2-13.pptx
JuanPicasso7
 
beginners_python_cheat_sheet -python cheat sheet description
NaveenVarma Chintalapati
 
PYTHON-PROGRAMMING-UNIT-III.pptx kghbg kfhjf jruufg jtuuf
DeepakRattan3
 
listtupledictionary-2001okdhfuihcasbdjj02082611.pptx
meganathan162007
 
Lecture2.pptx
Sakith1
 
Pythonlearn-08-Lists.pptx
MihirDatir
 
listppt.pptx h4wtgesvzdfvgsrbyhrrtgsvefcdef
rajpalyadav13052024
 
IPP-M2-C1-Lists-Data Types.pptx for project management
tahir843188
 
Module-2.pptx
GaganRaj28
 
Ad

More from vikram mahendra (20)

PPTX
Communication skill
vikram mahendra
 
PDF
Python Project On Cosmetic Shop system
vikram mahendra
 
PDF
Python Project on Computer Shop
vikram mahendra
 
PDF
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
PDF
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
PPTX
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
PPTX
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
PPTX
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
PPTX
OPERATOR IN PYTHON-PART1
vikram mahendra
 
PPTX
OPERATOR IN PYTHON-PART2
vikram mahendra
 
PPTX
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
PPTX
DATA TYPE IN PYTHON
vikram mahendra
 
PPTX
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
PPTX
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
PPTX
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
PPTX
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
PPTX
Python Introduction
vikram mahendra
 
PPTX
GREEN SKILL[PART-2]
vikram mahendra
 
PPTX
GREEN SKILLS[PART-1]
vikram mahendra
 
PPTX
Dictionary in python
vikram mahendra
 
Communication skill
vikram mahendra
 
Python Project On Cosmetic Shop system
vikram mahendra
 
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
DATA TYPE IN PYTHON
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Python Introduction
vikram mahendra
 
GREEN SKILL[PART-2]
vikram mahendra
 
GREEN SKILLS[PART-1]
vikram mahendra
 
Dictionary in python
vikram mahendra
 
Ad

Recently uploaded (20)

PPTX
Photo chemistry Power Point Presentation
mprpgcwa2024
 
PPTX
Urban Hierarchy and Service Provisions.pptx
Islamic University of Bangladesh
 
PPT
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
PDF
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PDF
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
PPTX
Project 4 PART 1 AI Assistant Vocational Education
barmanjit380
 
PDF
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PPTX
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
PDF
Rapid Mathematics Assessment Score sheet for all Grade levels
DessaCletSantos
 
PPTX
A Case of Identity A Sociological Approach Fix.pptx
Ismail868386
 
PDF
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
DOCX
DLL english grade five goof for one week
FlordelynGonzales1
 
PPTX
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PDF
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
PPTX
How to use _name_search() method in Odoo 18
Celine George
 
Photo chemistry Power Point Presentation
mprpgcwa2024
 
Urban Hierarchy and Service Provisions.pptx
Islamic University of Bangladesh
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
Project 4 PART 1 AI Assistant Vocational Education
barmanjit380
 
The Power of Compound Interest (Stanford Initiative for Financial Decision-Ma...
Stanford IFDM
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
2025 Completing the Pre-SET Plan Form.pptx
mansk2
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
Rapid Mathematics Assessment Score sheet for all Grade levels
DessaCletSantos
 
A Case of Identity A Sociological Approach Fix.pptx
Ismail868386
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
DLL english grade five goof for one week
FlordelynGonzales1
 
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
How to use _name_search() method in Odoo 18
Celine George
 

LIST IN PYTHON

  • 1. [DECLARATION AND INTIALIZATION OF LIST] COMPUTER SCIENCE(083) CLASS: XII LIST IN PYTHON PART-1
  • 2. What is List? How we declare a List? How we initialize a List? Different methods of initializing list.
  • 3. WHAT IS LIST: A list is a collection of values or an ordered sequence of values. Values in the list can be Elements of a list enclosed in a square brackets [ ], separated by commas (,) . Syntax: list_name= [value1, value2,……..,valueN] Example: No_list = [ 10, 20, 30, 40, 50 ]
  • 4. HOW TO CREATE AND INITIALIZE LIST Method 1: If list is declare empty. list1=[ ] Method 2: Initialize list with value: If we want to store the numbers in a list. list2= [10, 20, 30, 40, 50] If we want to store the words or string in a list. list3= [“Mango”, “Apple”,”Grapes”,”Oranges”]
  • 5. HOW TO CREATE AND INITIALIZE LIST If we want to store the characters in a list. list4= [‘A’,’E’,’I’,’O’,’U’] If we want to store the mixed information in a list. list4= [“Kapil”, 13,”Class-IX”, 40]
  • 6. TO DISPLAY THE LIST Example: list2= [10, 20, 30, 40, 50] print(list2) ----------------Output------------- [10, 20, 30, 40, 50] Example: list3= [“Mango”, “Apple”,”Grapes”,”Oranges”] print(list3) ----------------Output------------- [‘Mango’, ‘Apple’, ’Grapes’, ’Oranges’]
  • 7. HOW TO CREATE AND INITIALIZE THE LIST USING LIST() CONSTRUCTOR Syntax: list_name=list(sequence or string) Example: list1=list(‘Computer’) print(list1) ----------output---------- [‘C’,’o’,’m’,’p’,’u’,’t’,’e’,’r’] If we want to store the characters in a list. list4= list((‘A’,’E’,’I’,’O’,’U’)) ---------Output---------- [‘A’, ‘E’,’I’,’O’,’U’]
  • 8. HOW TO CREATE AND INITIALIZE THE LIST USING LIST() CONSTRUCTOR Example: If we want to store the mixed information in a list. list4= list((“Kapil”, 13,”Class-IX”, 40)) ----------------Output------------- [‘Kapil’, 13,’Class-IX’, 40] Example: If we want to store the numbers in a list. List_=list((10, 20, 30, 40, 50)) ----------------Output------------- [10, 20, 30, 40, 50]
  • 9. HOW USER ENTER THE VALUES IN A LIST AT RUN TIME Using input() function how we can enter the number inside the list. If we want to enter number 1,2,3,4,5,6,7,8,9 using keyboard at the run time Example: no=list(input(“Enter the no”)) print(no) -----------Output------------- [‘1’,’2’,’3’,’4’,’5’,’6’,’7’,’8’,’9’] These numbers are store in a character format as these numbers are display in ‘1’ format.
  • 10. We can use eval( ) method, which identifies the data type and evaluate them automatically. Example: no=eval(input(“Enter the no:”)) print(no) -------Input----------- Enter the no: [1,2,3,4,5,6,7,8,9] -----------Output------------- [1,2,3,4,5,6,7,8,9] -------Input----------- Enter the no: 1,2,3,4,5,6,7,8,9 -----------Output------------- (1,2,3,4,5,6,7,8,9) If you enter the number with square brackets it will create List If you enter the number without square brackets it will create tuple