SlideShare a Scribd company logo
1 of 16
Chapter 2
Revision of the Basics of Python - II
Class – XII
Subject: Computer Science
Tuples
 Its Sequence of values of any data type enclosed
in round brackets.
 Tuples are Immutable .
 Examples:-
 () is a tuple with no element
 (6, ) is a tuple with one element
 (‘a’, 2, 5.77) is a tuple of mixed data types
Creating Tuples
 By enclosing values in parentheses
 A = (1,2,3)
 B = (“Ram”, “Sham”, “Anil”)
 Using function tuple(<any sequence>)
 A = tuple(“WELCOME”)
 B=tuple([1,2,3,4])
 C = tuple(input(“enter any sequence”))
 Using eval()
 Most common method used to create tuple
 A = eval(“(1,2,3,4)”)
Similarities with Lists
 len() function
 Returns number of elements in tuple and list both
 Indexing and slicing
 Indexing and Slicing is same in list and tuple
 Membership operators
 ‘in’ and ‘not in’ operators work similarly for tuple and lists
 + and * operators
 Concatenation and Replication
 Traversing
 Traversing list and tuple is same
 for <Item> in <tuple/list> :
Process <item>
Similarities with Lists
 Unpacking
 Unpacking is same for lists and tuples
 E.g. A = (1,2,3,4)
 X,Y,Z,W = A
 Count() method
 Count() method works similarly for lists and tuples
Differences with Lists
 As tuple is immutable, Changing tuple elements
is not allowed
 e.g. A= (1,2,3)
 A[2] = 4 # this is not allowed
 Adding or deleting elements in tuple is not
allowed
 max() and min() functions for tuples
 max(<tuple>) gives maximum value in tuple
 min(<tuple>) gives minimum value in a tuple
 max() and min() works only if all the elements of
tuple are of same data type
Copying A list
 How to create a copy of a List?
 Lets say we have a list
 L = [1,2,3,4]
How to create a copy L_Copy of this
list L???
 L_Copy = list(L)
List Reverse and Sort
 Function List.reverse() is used to reverse a list
 Function List.sort() is used to sort a list
 By default sorting is done in which order?
 Increasing order
 How to do sorting in decreasing order ?
 List.sort(reverse = True)
Dictionary
 Dictionary in python is an unordered pair of keys:
values
 Dictionary is not a sequence, its not indexed by
using numbers
 Dictionary is created using curly braces ( { } )
 Dictionary is indexed by using Keys
 Dictionary keys are immutable and all the keys
should be unique
 Dictionary is a mutable data object, Its values can
be changed (not keys)
How to create Dictionary
 Simply by enclosing Key:Value pairs in curly
braces
 D1 = { 1 : “David” , 2 : “Rick , 3: “Kiya” }
 D2 = {} #this is an empty dictionary
 By adding key:value pairs in an empty dictionary
 D2 = {}
 D2[1] = ‘A’
 It will create dictionary D2 = {1:’A’}
Creating dictionary : dict() function
 Dictionary can be created by passing key and value
pairs to dict() function. There are multiple ways to do
so—
 1. By passing arguments and values
 D1 = dict(rollno = 1, name = ‘Ajay’, marks = 90)
 2. By passing keys and values using zip function
 D1 = dict(zip(‘rollno’,’name’,’marks’ ), (1,’Ajay’,90))
 3. By passing key:value pair in the form of sequence
 D1 = dict([[‘rollno’ ,1],[‘name’,’Ajay’],[‘Marks’,90]]
Traversing Dictionary
 for <Item> in <Dictionary>
Process <Item>
#Here <Item> will be assigned the keys of dictionary
D1 = {1 : ‘A’, 2: ‘B’, 3 : ‘C’ }
for i in D1:
print( i , D1[i}
Adding and Updating elements of
Dictionary ? How?
 D1 = {‘RollNo’ : 1, ‘Name’ : ‘Ajay’}
 How to add new key value pair as “Marks” : 90??
 D1[“Marks”] = 90
 How to update Marks to 95??
 D1[“Marks”] = 95
Deleting elements of dictionary
 1. using del command
 del <dictionary>[<key>]
 If <key> does not exist in <dictionary> python will throw error
 del D1[‘Marks’]
 del D1 #It will delete entire D1 dictionary object
 2. Using pop() method
 <dictionary>.pop(<key>)
 D1.pop(‘Marks’)
 If <key> does not exist , python will throw error
 But you can give your own error message
 D1.pop(‘Marks’, “Not Found”)
Membership Operators for Dictionary
 How in and not in operator works for dictionaries?
 in and not in operator checks for existence of keys
in dictionary
 in operator will return True if given KEY exist in
dictionary
 not in operator will return True if given KEY does
not exist in dictionary
Methods for Dictionaries
1. len(<dictionary>) : It gives length of
dictionary(number of pairs )
2. <dictionary>.clear(): It gives empty dictionary
3. <dictionary>.get(<key>) : to get value for a Key
4. <dictionary>.items(): it gives sequence of
tuples(key, value)
5. <dictionary>.keys() : It returns all keys as a list
6. <dictionary>.values(): It returns all values a a list
7. <dictionary>.update() : this method merges two
dictionaries

More Related Content

Similar to UNIT 1 - Revision of Basics - II.pptx

Revision Tour 1 and 2 complete.doc
Revision Tour 1 and 2 complete.docRevision Tour 1 and 2 complete.doc
Revision Tour 1 and 2 complete.docSrikrishnaVundavalli
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionarySoba Arjun
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Simplilearn
 
Ch 7 Dictionaries 1.pptx
Ch 7 Dictionaries 1.pptxCh 7 Dictionaries 1.pptx
Ch 7 Dictionaries 1.pptxKanchanaRSVVV
 
PPT data science python sequence numpy.pptx
PPT data science python sequence numpy.pptxPPT data science python sequence numpy.pptx
PPT data science python sequence numpy.pptxAkashAgrawal434750
 
Beginner's Python Cheat Sheet.pdf
Beginner's Python Cheat Sheet.pdfBeginner's Python Cheat Sheet.pdf
Beginner's Python Cheat Sheet.pdfAkhileshKumar436707
 
File handling in pythan.pptx
File handling in pythan.pptxFile handling in pythan.pptx
File handling in pythan.pptxNawalKishore38
 
Python data type
Python data typePython data type
Python data typeJaya Kumari
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear listsToniyaP1
 

Similar to UNIT 1 - Revision of Basics - II.pptx (20)

GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
Revision Tour 1 and 2 complete.doc
Revision Tour 1 and 2 complete.docRevision Tour 1 and 2 complete.doc
Revision Tour 1 and 2 complete.doc
 
Lecture-5.pdf
Lecture-5.pdfLecture-5.pdf
Lecture-5.pdf
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
 
Lecture-6.pdf
Lecture-6.pdfLecture-6.pdf
Lecture-6.pdf
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 
02python.ppt
02python.ppt02python.ppt
02python.ppt
 
02python.ppt
02python.ppt02python.ppt
02python.ppt
 
Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...Python Interview Questions | Python Interview Questions And Answers | Python ...
Python Interview Questions | Python Interview Questions And Answers | Python ...
 
Ch 7 Dictionaries 1.pptx
Ch 7 Dictionaries 1.pptxCh 7 Dictionaries 1.pptx
Ch 7 Dictionaries 1.pptx
 
Dictionaries.pptx
Dictionaries.pptxDictionaries.pptx
Dictionaries.pptx
 
PPT data science python sequence numpy.pptx
PPT data science python sequence numpy.pptxPPT data science python sequence numpy.pptx
PPT data science python sequence numpy.pptx
 
Lists_tuples.pptx
Lists_tuples.pptxLists_tuples.pptx
Lists_tuples.pptx
 
Pytho dictionaries
Pytho dictionaries Pytho dictionaries
Pytho dictionaries
 
Sixth session
Sixth sessionSixth session
Sixth session
 
Beginner's Python Cheat Sheet.pdf
Beginner's Python Cheat Sheet.pdfBeginner's Python Cheat Sheet.pdf
Beginner's Python Cheat Sheet.pdf
 
File handling in pythan.pptx
File handling in pythan.pptxFile handling in pythan.pptx
File handling in pythan.pptx
 
Python data type
Python data typePython data type
Python data type
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear lists
 

Recently uploaded

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Recently uploaded (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

UNIT 1 - Revision of Basics - II.pptx

  • 1. Chapter 2 Revision of the Basics of Python - II Class – XII Subject: Computer Science
  • 2. Tuples  Its Sequence of values of any data type enclosed in round brackets.  Tuples are Immutable .  Examples:-  () is a tuple with no element  (6, ) is a tuple with one element  (‘a’, 2, 5.77) is a tuple of mixed data types
  • 3. Creating Tuples  By enclosing values in parentheses  A = (1,2,3)  B = (“Ram”, “Sham”, “Anil”)  Using function tuple(<any sequence>)  A = tuple(“WELCOME”)  B=tuple([1,2,3,4])  C = tuple(input(“enter any sequence”))  Using eval()  Most common method used to create tuple  A = eval(“(1,2,3,4)”)
  • 4. Similarities with Lists  len() function  Returns number of elements in tuple and list both  Indexing and slicing  Indexing and Slicing is same in list and tuple  Membership operators  ‘in’ and ‘not in’ operators work similarly for tuple and lists  + and * operators  Concatenation and Replication  Traversing  Traversing list and tuple is same  for <Item> in <tuple/list> : Process <item>
  • 5. Similarities with Lists  Unpacking  Unpacking is same for lists and tuples  E.g. A = (1,2,3,4)  X,Y,Z,W = A  Count() method  Count() method works similarly for lists and tuples
  • 6. Differences with Lists  As tuple is immutable, Changing tuple elements is not allowed  e.g. A= (1,2,3)  A[2] = 4 # this is not allowed  Adding or deleting elements in tuple is not allowed  max() and min() functions for tuples  max(<tuple>) gives maximum value in tuple  min(<tuple>) gives minimum value in a tuple  max() and min() works only if all the elements of tuple are of same data type
  • 7. Copying A list  How to create a copy of a List?  Lets say we have a list  L = [1,2,3,4] How to create a copy L_Copy of this list L???  L_Copy = list(L)
  • 8. List Reverse and Sort  Function List.reverse() is used to reverse a list  Function List.sort() is used to sort a list  By default sorting is done in which order?  Increasing order  How to do sorting in decreasing order ?  List.sort(reverse = True)
  • 9. Dictionary  Dictionary in python is an unordered pair of keys: values  Dictionary is not a sequence, its not indexed by using numbers  Dictionary is created using curly braces ( { } )  Dictionary is indexed by using Keys  Dictionary keys are immutable and all the keys should be unique  Dictionary is a mutable data object, Its values can be changed (not keys)
  • 10. How to create Dictionary  Simply by enclosing Key:Value pairs in curly braces  D1 = { 1 : “David” , 2 : “Rick , 3: “Kiya” }  D2 = {} #this is an empty dictionary  By adding key:value pairs in an empty dictionary  D2 = {}  D2[1] = ‘A’  It will create dictionary D2 = {1:’A’}
  • 11. Creating dictionary : dict() function  Dictionary can be created by passing key and value pairs to dict() function. There are multiple ways to do so—  1. By passing arguments and values  D1 = dict(rollno = 1, name = ‘Ajay’, marks = 90)  2. By passing keys and values using zip function  D1 = dict(zip(‘rollno’,’name’,’marks’ ), (1,’Ajay’,90))  3. By passing key:value pair in the form of sequence  D1 = dict([[‘rollno’ ,1],[‘name’,’Ajay’],[‘Marks’,90]]
  • 12. Traversing Dictionary  for <Item> in <Dictionary> Process <Item> #Here <Item> will be assigned the keys of dictionary D1 = {1 : ‘A’, 2: ‘B’, 3 : ‘C’ } for i in D1: print( i , D1[i}
  • 13. Adding and Updating elements of Dictionary ? How?  D1 = {‘RollNo’ : 1, ‘Name’ : ‘Ajay’}  How to add new key value pair as “Marks” : 90??  D1[“Marks”] = 90  How to update Marks to 95??  D1[“Marks”] = 95
  • 14. Deleting elements of dictionary  1. using del command  del <dictionary>[<key>]  If <key> does not exist in <dictionary> python will throw error  del D1[‘Marks’]  del D1 #It will delete entire D1 dictionary object  2. Using pop() method  <dictionary>.pop(<key>)  D1.pop(‘Marks’)  If <key> does not exist , python will throw error  But you can give your own error message  D1.pop(‘Marks’, “Not Found”)
  • 15. Membership Operators for Dictionary  How in and not in operator works for dictionaries?  in and not in operator checks for existence of keys in dictionary  in operator will return True if given KEY exist in dictionary  not in operator will return True if given KEY does not exist in dictionary
  • 16. Methods for Dictionaries 1. len(<dictionary>) : It gives length of dictionary(number of pairs ) 2. <dictionary>.clear(): It gives empty dictionary 3. <dictionary>.get(<key>) : to get value for a Key 4. <dictionary>.items(): it gives sequence of tuples(key, value) 5. <dictionary>.keys() : It returns all keys as a list 6. <dictionary>.values(): It returns all values a a list 7. <dictionary>.update() : this method merges two dictionaries