Class 3
Class 3
• List
• Tuples
• Sets
• Dictionary
• strings
LIST
• A list is data type which help to store more then one values .or it help to
store various type of data(integer, float, string…).
• List is only in python ,in other language we use array.
• To make list use []and separate the item by (,) comma.
• It is mutable ,ordered , can access by index, allow Duplicates.
LIST
• Type:- type is the function which give information about the object
• Syntax:- type().
DIFFERENCE BETWEEN
Function Method
• Function do not have any reference • Method are called by reference
variables. variable.
• All type of data is passed is exactly • It is a way to pass the data(set of
passed. rules).
• It does not have to controlling(other • It has access to controlling , method
then the statics),declare and define should declare and define the class
in the code must need.
LIST
• BASIC:-
• To create empty list :- variables _name =[ ]
LIST INDEXING
• Slicing is the way to get any element from the object(list , string).
• Syntax:- [start: end: steps(optional)]
• It means we can access the every element in the list or we can change the
element as per need.
• With the help if index number we can do this ,the index number start with
0(zero).
ADD NEW ELEMENTS
Insert Extend
REMOVE NEW ELEMENTS
Remove() Pop()
DEL() & CLEAR()
METHOD IN LIST
TUPLE
• Upper:- This method used to change the alphabet from lower to upper.
• Lower:-This method used to change the alphabet from upper to lower.
• Replace :- Help to replace the string from another.
• Split:- Help to break the string or replace.
• Capitalize:- help to you capital the first letter.
• Count:- help to count the value in string.
• Find:- to find the value in the string.
• Join:- To join the two or more string.
METHOD
TASK
Types of error ,