0% found this document useful (0 votes)
23 views32 pages

Class 3

Uploaded by

abhivrat pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views32 pages

Class 3

Uploaded by

abhivrat pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

TOPICS

• 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

• Indexing is a way to traversing or access the elements or values in


programming .
NEGATIVE INDEXING
LIST SLICING

• Slicing is the way to get any element from the object(list , string).
• Syntax:- [start: end: steps(optional)]

• Does negative slicing existing?


• Yes ! You can do negative slicing..
GET ELEMENT OF LIST

• 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

• There are multiple ways to add elements in the list


• 1) append:- this method add elements in the last of the list
• 2) insert:- this method help to add elements in the middle of list
• 3) extend:- it help to merge the 2 list or elements.
ADDING ELEMENTS

Insert Extend
REMOVE NEW ELEMENTS

• We can add or remove the elements from the list.


• Methods:-
• 1) Remove :- particularly we can remove any elements.
• 2) pop:- it help to remove the elements by index number.
• 3) del:- it can remove the elements by the index number as well as delete all
elements from the list.
• 4) clear:- this method help to empty the list.
REMOVE & POP METHOD

Remove() Pop()
DEL() & CLEAR()
METHOD IN LIST
TUPLE

• Tuples is a collection of values separated by comma(),


• It is ordered and immutable.
• It use parentheses() ,it allows duplicate value.
• ** it is the collection of string (more then one elements).
ACCESS
METHOD IN TUPLE

• min():- it gives you minimum value from the tuple .


• max();- it gives you maximum value from the tuple.
• len():- it gives you length of the tuples
• index():- it start with zero(0),and you can traverse.
• count():- it show number of that elements present in the list .
SETS

• Sets are the unordered , unchangeable , collection of data.


• Set elements are unique. Duplicate elements are not allowed.
• A set itself may be modified, but the elements contained in the set must be
of an immutable type.
• It represent with {}curly braces/bracket.
SET()

Set details Check elements in set()


• In key word help to check the
element in the list, dictionary, tuple,
sets.
METHOD

• Add:- This function help to add element in set.


• Update :- This function help to update the from other list or elements.
METHODS IN SET()
DICTIONARY

• Dictionary is the unordered collection of data values.


• Is used (:)colon to separate the columns.
• It Is mutable , dynamic and do not allow duplicates.
• It contains key : value and separated by commas.
• Syntax:
• Duct={
keys: values ,
keys: values
}
DICTIONARY
KEYS
• Keys is a method to view object display in the values or list.
• Value:- it is a view of dictionary, Changes will reflect in the value or key list.
TRAVERSE AND CHANGE
METHOD()
STRING

• String are the collection of words and character.


• String use single and double quotes to represent itself.
SLICING AND INDEXING
METHODS IN STRING

• 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

• Does list support symbols . if yes why….


• Use type and len function in all previous class.
• Negative slicing try yourself.
• Make the hotel menu card

Types of error ,

You might also like