SlideShare a Scribd company logo
Basics of
Python
STRINGS AND LISTS
String
 A String is a data structure in Python that
represents a sequence of characters. It is an
immutable data type, meaning that once you
have created a string, you cannot change it.
Strings are used widely in many different
applications, such as storing and manipulating
text data, representing names, addresses, and
other types of data that can be represented as
text.
 Example:
 "Geeksforgeeks" or 'Geeksforgeeks' or "a"
Creating a String in Python
 Strings in Python can be created using single
quotes or double quotes or even triple quotes. Let
us see how we can define a string in Python.
 Example:
 In this example, we will demonstrate different
ways to create a Python String. We will create a
string using single quotes (‘ ‘), double quotes (” “),
and triple double quotes (“”” “””). The triple
quotes can be used to declare multiline strings in
Python.
Accessing characters in
Python String
 In Python, individual characters of a String
can be accessed by using the method of
Indexing. Indexing allows negative address
references to access characters from the back of
the String, e.g. -1 refers to the last character, -2
refers to the second last character, and so on.
 While accessing an index out of the range
will cause an IndexError. Only Integers are allowed
to be passed as an index, float or other types that
will cause a TypeError.
Example
 In this example, we will define a string in
Python and access its characters using positive
and negative indexing. The 0th element will be
the first character of the string whereas the -1th
element is the last character of the string.
String Slicing
 In Python, the String Slicing method is used to
access a range of characters in the String. Slicing
in a String is done by using a Slicing operator, i.e.,
a colon (:). One thing to keep in mind while using
this method is that the string returned after slicing
includes the character at the start index but not
the character at the last index.
Reversing a Python String
 By accessing characters from a string, we
can also reverse strings in Python. We can Reverse
a string by using String slicing method.
Updating Entire String
 As Python strings are immutable in nature, we
cannot update the existing string. We can only
assign a completely new value to the variable
with the same name.
Formatting of Strings
 Strings in Python can be formatted with the
use of format() method which is a very versatile
and powerful tool for formatting Strings. Format
method in String contains curly braces {} as
placeholders which can hold arguments
according to position or keyword to specify the
order.
 # Python Program for
 # Formatting of Strings
 # Default order
 String1 = "{} {} {}".format('Geeks', 'For', 'Life')
 print("Print String in default order: ")
 print(String1)
 # Positional Formatting
 String1 = "{1} {0} {2}".format('Geeks', 'For', 'Life')
 print("nPrint String in Positional order: ")
 print(String1)
 # Keyword Formatting
 String1 = "{l} {f} {g}".format(g='Geeks', f='For', l='Life')
 print("nPrint String in order of Keywords: ")
 print(String1)
isupper() in Python
 In Python, isupper() is a built-in method used for
string handling. This method returns “True” if all
characters in the string are uppercase, otherwise,
returns “False”.
 It returns “True” for whitespaces but if there is only
whitespace in the string then returns “False”.
 It does not take any arguments, Therefore,
 It returns an error if a parameter is passed.
 Digits and symbols return “True” but if the
 string contains only digits and numbers
 then returns “False”
 This function is used to check if the argument
contains any uppercase characters such as:
islower() in Python
 In Python, islower() is a built-in method used
for string handling. The islower() method
returns True if all characters in the string are
lowercase, otherwise, returns “False”.
 It returns “True” for whitespaces but if there is only
whitespace in the string then returns “False”.
 It does not take any arguments, Therefore, It
returns an error if a parameter is passed.
 Digits and symbols return “True” but if the string
contains only digits and numbers then returns
“False”.
 This function is used to check if the argument
contains any lowercase characters such as :
upper() in Python
 In Python, upper() is a built-in method used
for string handling. The upper() method returns the
uppercased string from the given string. It
converts all lowercase characters to uppercase. If
no lowercase characters exist, it returns the
original string.
 It does not take any arguments, Therefore, It
returns an error if a parameter is passed. Digits
and symbols return are returned as it is, Only a
lowercase letter is returned after converting to
uppercase.
List
 In Python, the sequence of various data types is
stored in a list. A list is a collection of different kinds of
values or items. Since Python lists are mutable, we
can change their elements after forming. The
comma (,) and the square brackets [enclose the
List's items] serve as separators.
 Although six Python data types can hold sequences,
the List is the most common and reliable form. A list,
a type of sequence data, is used to store the
collection of data. Tuples and Strings are two similar
data formats for sequences.
 Lists written in Python are identical to dynamically
scaled arrays defined in other languages, such as
Array List in Java and Vector in C++. A list is a
collection of items separated by commas and
denoted by the symbol [].
List Declaration
Characteristics of Lists
 The lists are in order.
 The list element can be accessed via the index.
 The mutable type of List is
 The rundowns are changeable sorts.
 The number of various elements can be stored in
a list.
Python List Operations
 In Python, List is a sequence. Hence, we can
concatenate two lists with "+" operator and
concatenate multiple copies of a list with "*"
operator. The membership operators "in" and "not
in" work with list object.
List methods in Python
 Python List Methods has multiple methods to
work with Python lists, Below we’ve explained all
the methods you can use with Python lists, for
example, append(), copy(), insert(), and more.
Adding Element in List
 Python append()
 Used for appending and adding elements to the
List. It is used to add elements to the last position
of the List in Python.
 Syntax: list.append (element)
Python insert()
 Inserts an element at the specified position.
 Syntax:
 list.insert(<position, element)
Python extend()
 Adds contents to List2 to the end of List1.
 Syntax: List1.extend(List2)

More Related Content

Similar to ppt notes python language operators and data

STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
TanushTM1
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
Devashish Kumar
 
Data structures in Python
Data structures in PythonData structures in Python
Data structures in Python
MITULJAMANG
 
Python ppt_118.pptx
Python ppt_118.pptxPython ppt_118.pptx
Python ppt_118.pptx
MadhuriAnaparthy
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
ssuser8e50d8
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
Eduardo Bergavera
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
Python Strings Methods
Python Strings MethodsPython Strings Methods
Python Strings Methods
Mr Examples
 
String handling
String handlingString handling
String handling
ssuser20c32b
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
ParrotAI
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
Mr. Vikram Singh Slathia
 
Data types in python
Data types in pythonData types in python
Data types in python
Learnbay Datascience
 
unit 1.docx
unit 1.docxunit 1.docx
unit 1.docx
ssuser2e84e4
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
jaba kumar
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
Rasan Samarasinghe
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
adityakumawat625
 
Biswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptxBiswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptx
BiswambarBehera5
 

Similar to ppt notes python language operators and data (20)

STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Data structures in Python
Data structures in PythonData structures in Python
Data structures in Python
 
Python ppt_118.pptx
Python ppt_118.pptxPython ppt_118.pptx
Python ppt_118.pptx
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
LectureNotes-04-DSA
LectureNotes-04-DSALectureNotes-04-DSA
LectureNotes-04-DSA
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Python Strings Methods
Python Strings MethodsPython Strings Methods
Python Strings Methods
 
M C6java7
M C6java7M C6java7
M C6java7
 
String handling
String handlingString handling
String handling
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Data types in python
Data types in pythonData types in python
Data types in python
 
unit 1.docx
unit 1.docxunit 1.docx
unit 1.docx
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
 
Biswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptxBiswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptx
 

More from SukhpreetSingh519414

python full notes data types string and tuple
python full notes data types string and tuplepython full notes data types string and tuple
python full notes data types string and tuple
SukhpreetSingh519414
 
CPP-overviews notes variable data types notes
CPP-overviews notes variable data types notesCPP-overviews notes variable data types notes
CPP-overviews notes variable data types notes
SukhpreetSingh519414
 
ppt python notes list tuple data types ope
ppt python notes list tuple data types opeppt python notes list tuple data types ope
ppt python notes list tuple data types ope
SukhpreetSingh519414
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
SukhpreetSingh519414
 
finap ppt conference.pptx
finap ppt conference.pptxfinap ppt conference.pptx
finap ppt conference.pptx
SukhpreetSingh519414
 
final security ppt.pptx
final security ppt.pptxfinal security ppt.pptx
final security ppt.pptx
SukhpreetSingh519414
 

More from SukhpreetSingh519414 (8)

python full notes data types string and tuple
python full notes data types string and tuplepython full notes data types string and tuple
python full notes data types string and tuple
 
CPP-overviews notes variable data types notes
CPP-overviews notes variable data types notesCPP-overviews notes variable data types notes
CPP-overviews notes variable data types notes
 
ppt python notes list tuple data types ope
ppt python notes list tuple data types opeppt python notes list tuple data types ope
ppt python notes list tuple data types ope
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
 
C%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdfC%20ARRAYS.pdf.pdf
C%20ARRAYS.pdf.pdf
 
java exception.pptx
java exception.pptxjava exception.pptx
java exception.pptx
 
finap ppt conference.pptx
finap ppt conference.pptxfinap ppt conference.pptx
finap ppt conference.pptx
 
final security ppt.pptx
final security ppt.pptxfinal security ppt.pptx
final security ppt.pptx
 

Recently uploaded

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 

ppt notes python language operators and data

  • 2. String  A String is a data structure in Python that represents a sequence of characters. It is an immutable data type, meaning that once you have created a string, you cannot change it. Strings are used widely in many different applications, such as storing and manipulating text data, representing names, addresses, and other types of data that can be represented as text.  Example:  "Geeksforgeeks" or 'Geeksforgeeks' or "a"
  • 3. Creating a String in Python  Strings in Python can be created using single quotes or double quotes or even triple quotes. Let us see how we can define a string in Python.  Example:  In this example, we will demonstrate different ways to create a Python String. We will create a string using single quotes (‘ ‘), double quotes (” “), and triple double quotes (“”” “””). The triple quotes can be used to declare multiline strings in Python.
  • 4. Accessing characters in Python String  In Python, individual characters of a String can be accessed by using the method of Indexing. Indexing allows negative address references to access characters from the back of the String, e.g. -1 refers to the last character, -2 refers to the second last character, and so on.  While accessing an index out of the range will cause an IndexError. Only Integers are allowed to be passed as an index, float or other types that will cause a TypeError.
  • 5. Example  In this example, we will define a string in Python and access its characters using positive and negative indexing. The 0th element will be the first character of the string whereas the -1th element is the last character of the string.
  • 6. String Slicing  In Python, the String Slicing method is used to access a range of characters in the String. Slicing in a String is done by using a Slicing operator, i.e., a colon (:). One thing to keep in mind while using this method is that the string returned after slicing includes the character at the start index but not the character at the last index.
  • 7. Reversing a Python String  By accessing characters from a string, we can also reverse strings in Python. We can Reverse a string by using String slicing method.
  • 8. Updating Entire String  As Python strings are immutable in nature, we cannot update the existing string. We can only assign a completely new value to the variable with the same name.
  • 9. Formatting of Strings  Strings in Python can be formatted with the use of format() method which is a very versatile and powerful tool for formatting Strings. Format method in String contains curly braces {} as placeholders which can hold arguments according to position or keyword to specify the order.
  • 10.  # Python Program for  # Formatting of Strings  # Default order  String1 = "{} {} {}".format('Geeks', 'For', 'Life')  print("Print String in default order: ")  print(String1)  # Positional Formatting  String1 = "{1} {0} {2}".format('Geeks', 'For', 'Life')  print("nPrint String in Positional order: ")  print(String1)  # Keyword Formatting  String1 = "{l} {f} {g}".format(g='Geeks', f='For', l='Life')  print("nPrint String in order of Keywords: ")  print(String1)
  • 11. isupper() in Python  In Python, isupper() is a built-in method used for string handling. This method returns “True” if all characters in the string are uppercase, otherwise, returns “False”.  It returns “True” for whitespaces but if there is only whitespace in the string then returns “False”.  It does not take any arguments, Therefore,  It returns an error if a parameter is passed.  Digits and symbols return “True” but if the  string contains only digits and numbers  then returns “False”  This function is used to check if the argument contains any uppercase characters such as:
  • 12. islower() in Python  In Python, islower() is a built-in method used for string handling. The islower() method returns True if all characters in the string are lowercase, otherwise, returns “False”.  It returns “True” for whitespaces but if there is only whitespace in the string then returns “False”.  It does not take any arguments, Therefore, It returns an error if a parameter is passed.  Digits and symbols return “True” but if the string contains only digits and numbers then returns “False”.  This function is used to check if the argument contains any lowercase characters such as :
  • 13.
  • 14. upper() in Python  In Python, upper() is a built-in method used for string handling. The upper() method returns the uppercased string from the given string. It converts all lowercase characters to uppercase. If no lowercase characters exist, it returns the original string.  It does not take any arguments, Therefore, It returns an error if a parameter is passed. Digits and symbols return are returned as it is, Only a lowercase letter is returned after converting to uppercase.
  • 15. List  In Python, the sequence of various data types is stored in a list. A list is a collection of different kinds of values or items. Since Python lists are mutable, we can change their elements after forming. The comma (,) and the square brackets [enclose the List's items] serve as separators.  Although six Python data types can hold sequences, the List is the most common and reliable form. A list, a type of sequence data, is used to store the collection of data. Tuples and Strings are two similar data formats for sequences.  Lists written in Python are identical to dynamically scaled arrays defined in other languages, such as Array List in Java and Vector in C++. A list is a collection of items separated by commas and denoted by the symbol [].
  • 17. Characteristics of Lists  The lists are in order.  The list element can be accessed via the index.  The mutable type of List is  The rundowns are changeable sorts.  The number of various elements can be stored in a list.
  • 18. Python List Operations  In Python, List is a sequence. Hence, we can concatenate two lists with "+" operator and concatenate multiple copies of a list with "*" operator. The membership operators "in" and "not in" work with list object.
  • 19. List methods in Python  Python List Methods has multiple methods to work with Python lists, Below we’ve explained all the methods you can use with Python lists, for example, append(), copy(), insert(), and more.
  • 20. Adding Element in List  Python append()  Used for appending and adding elements to the List. It is used to add elements to the last position of the List in Python.  Syntax: list.append (element)
  • 21. Python insert()  Inserts an element at the specified position.  Syntax:  list.insert(<position, element)
  • 22. Python extend()  Adds contents to List2 to the end of List1.  Syntax: List1.extend(List2)