SlideShare a Scribd company logo
AI Club
Python with AI - I
Dictionaries
• A dictionary consists of two things (a) keys (b) values
Dictionaries in python
• A dictionary consists of two things (a) keys (b) values
• Use strings to represent keys
Dictionaries in python
• A dictionary consists of two things (a) keys (b) values
• Use strings to represent keys
• Values can be anything
Dictionaries in python
• A dictionary consists of two things (a) keys (b) values
• Use strings to represent keys
• Values can be anything
• There are many ways to create a dictionary, we will look at one way
to do it:
Dictionaries in python
• A dictionary consists of two things (a) keys (b) values
• Use strings to represent keys
• Values can be anything
Dictionaries in python
Print the entire dictionary
• Print(my_dict)
• Please inspect the format in which it is printed.
• Where do the : symbols show up?
• Print(my_dict)
• Please inspect the format in which it is printed.
• Where do the colon (:) symbols show up?
• Where do the commas (,) show up?
Print the entire dictionary
• Create a dictionary, where the keys are one, two and the
corresponding values are 1 and 2
Exercise
• Create a dictionary, where the keys are one, two and the
corresponding values are 1 and 2
• Create a dictionary, where the keys are aiclub, PA1, M1 and the
corresponding values are website, python class, AI class.
Exercise
Dictionaries in python
• Print a value in a dictionary
• Print values of the first dictionary you created
• Print value corresponding to the key one
• Print value corresponding to the key two
Exercise
• Print values of the first dictionary you created
• Print value corresponding to the key one
• Print value corresponding to the key two
• Print values of the second dictionary you created
• Print value corresponding to the key aiclub
• Print value corresponding to the key M1
• Print value corresponding to the key PA1
Exercise
Dictionaries in python
• Print a value in a dictionary
• Delete a value in a dictionary
• Delete and print values of new dictionaries
• For the first dictionary
• Delete the value corresponding to the key one
• Print the value of dictionary
• For the second dictionary
• Delete the value corresponding to the key aiclub
• Print the value of dictionary
Exercise
Dictionaries in python
• Print a value in a dictionary
• Delete a value in a dictionary
• Print all keys of a dictionary
• Instead of printing the entire dictionary, please print only the keys of
the two dictionaries you created
Exercise
Dictionaries in python
• Print a value in a dictionary
• Delete a value in a dictionary
• Print all keys of a dictionary
• Add values to a dictionary
• Add the keys that you deleted from the 2 dictionaries back
• Print the two dictionaries
Exercise
loops and dictionaries – use together
• Loops - recap
• The for loop is of the following form.
• The range indicates the number of times a statement will be implemented.
• There is a colon value to indicate the start of for loop.
• The code below is executed many times. The number of times it gets executed
depends on the values specified in range.
• Note that the code below the for statement is indented.
Loops - recap
• The for loop is of the following form.
• Try different values inside the brackets of range
• Note that everything with indentation below for loop is executed as a
part of the loop.
• Exercise
a) Create a random number in the limits 0 and 10 using a random number
generator
Loops and Dictionaries
• Exercise
a) Create a random number in the limits 0 and 10 using a random number
generator
b) Create a list of length 10 using the random number generator (pick any
limits) – please use a loop
Loops and Dictionaries
Loops and Dictionaries
• Exercise
a) Create a random number in the limits 0 and 10 using a random number
generator
b) Create a list of length 10 using the random number generator (pick any
limits) – please use a loop
c) Now create a dictionary using the values of the list as keys and the
corresponding values for each key can be another random number (pick
any limits).
• A list holds ordered collection of items.
• And item can be a string or a number
Lists - recap
Lists - recap
• A list holds ordered collection of items.
• And item can be a string or a number
• An item can be a dictionary too
• Create a dictionary dict_1 with keys one, two, three and values 1, 2
and 3
• Create a dictionary dict_2 with keys one, two and three and values I,
II, III
List of dictionaries - Exercise
• Create a dictionary dict_1 with keys one, two, three and values 1, 2
and 3
• Create a dictionary dict_2 with keys one, two and three and values I,
II, III
• Create a list with these two dictionaries: list_dict = [dict_1, dict_2]
List of dictionaries - Exercise
• Create a dictionary dict_1 with keys one, two, three and values 1, 2
and 3
• Create a dictionary dict_2 with keys one, two and three and values I,
II, III
• Create a list with these two dictionaries: list_dict = [dict_1, dict_2]
• Print the value corresponding to the key one of first dictionary dict_1
from the list list_dict
List of dictionaries - Exercise
• Create a dictionary dict_1 with keys one, two, three and values 1, 2
and 3
• Create a dictionary dict_2 with keys one, two and three and values I,
II, III
• Create a list with these two dictionaries: list_dict = [dict_1, dict_2]
• Print the value corresponding to the key one of first dictionary dict_1
from the list list_dict
• Print the value corresponding to the key one of second dictionary
dict_2 from the list list_dict
List of dictionaries - Exercise
THANK YOU
https://aiclub.world
info@pyxeda.ai

More Related Content

What's hot

list procedures
list procedureslist procedures
list procedures
Rajendran
 
Intro to Lists
Intro to ListsIntro to Lists
Intro to Lists
primeteacher32
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
aiclub_slides
 
An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1
Blue Elephant Consulting
 
Stacks
StacksStacks
Stacks
abdullah619
 
Binary search
Binary searchBinary search
Binary search
Gaurav Solanki
 
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
sajinis3
 
3. python intro
3. python   intro3. python   intro
3. python intro
in4400
 
Programming in python - Week 3
Programming in python - Week 3Programming in python - Week 3
Programming in python - Week 3
Priya Nayak
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
sajinis3
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
 
Linear Search Presentation
Linear Search PresentationLinear Search Presentation
Linear Search Presentation
Markajul Hasnain Alif
 
An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2
Blue Elephant Consulting
 
Everything You Always Wanted To Know About SFX ...
Everything You Always Wanted To Know About SFX ...Everything You Always Wanted To Know About SFX ...
Everything You Always Wanted To Know About SFX ...Louise Penn
 
My MySQL SQL Presentation
My MySQL SQL PresentationMy MySQL SQL Presentation
My MySQL SQL Presentation
Justin Rhinesmith
 
Linked lists
Linked listsLinked lists
Linked lists
Eleonora Ciceri
 
Binary Search
Binary SearchBinary Search
Binary Search
kunj desai
 
Data structure unit I part B
Data structure unit I part BData structure unit I part B
Data structure unit I part B
SSN College of Engineering, Kalavakkam
 

What's hot (20)

list procedures
list procedureslist procedures
list procedures
 
Intro to Lists
Intro to ListsIntro to Lists
Intro to Lists
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
 
An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1
 
Stacks
StacksStacks
Stacks
 
Binary search
Binary searchBinary search
Binary search
 
Dsa – data structure and algorithms searching
Dsa – data structure and algorithms   searchingDsa – data structure and algorithms   searching
Dsa – data structure and algorithms searching
 
Chap10
Chap10Chap10
Chap10
 
3. python intro
3. python   intro3. python   intro
3. python intro
 
Programming in python - Week 3
Programming in python - Week 3Programming in python - Week 3
Programming in python - Week 3
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Linked lists
Linked listsLinked lists
Linked lists
 
Linear Search Presentation
Linear Search PresentationLinear Search Presentation
Linear Search Presentation
 
An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2
 
Everything You Always Wanted To Know About SFX ...
Everything You Always Wanted To Know About SFX ...Everything You Always Wanted To Know About SFX ...
Everything You Always Wanted To Know About SFX ...
 
My MySQL SQL Presentation
My MySQL SQL PresentationMy MySQL SQL Presentation
My MySQL SQL Presentation
 
Linked lists
Linked listsLinked lists
Linked lists
 
Binary Search
Binary SearchBinary Search
Binary Search
 
Data structure unit I part B
Data structure unit I part BData structure unit I part B
Data structure unit I part B
 

Similar to Dictionaries

Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
TamalSengupta8
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
ParveenShaik21
 
Pa2 session 1
Pa2 session 1Pa2 session 1
Pa2 session 1
aiclub_slides
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
ParveenShaik21
 
introduction to python
 introduction to python introduction to python
introduction to python
Jincy Nelson
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptx
lemonchoos
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ayshwarya Baburam
 
Programming in python Unit-1 Part-1
Programming in python Unit-1 Part-1Programming in python Unit-1 Part-1
Programming in python Unit-1 Part-1
Vikram Nandini
 
Python Data types like mutable and immutable
Python Data types like mutable and immutablePython Data types like mutable and immutable
Python Data types like mutable and immutable
ramireddyobulakondar
 
unit1 python.pptx
unit1 python.pptxunit1 python.pptx
unit1 python.pptx
TKSanthoshRao
 
An Introduction to Tuple List Dictionary in Python
An Introduction to Tuple List Dictionary in PythonAn Introduction to Tuple List Dictionary in Python
An Introduction to Tuple List Dictionary in Python
yashar Aliabasi
 
Python Programming and GIS
Python Programming and GISPython Programming and GIS
Python Programming and GIS
John Reiser
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
hardii0991
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
PranavSB
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
Ruth Marvin
 
presentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptxpresentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptx
ansariparveen06
 
Getting started in Python presentation by Laban K
Getting started in Python presentation by Laban KGetting started in Python presentation by Laban K
Getting started in Python presentation by Laban K
GDSCKYAMBOGO
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38
 

Similar to Dictionaries (20)

Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Pa2 session 1
Pa2 session 1Pa2 session 1
Pa2 session 1
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
introduction to python
 introduction to python introduction to python
introduction to python
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptx
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Programming in python Unit-1 Part-1
Programming in python Unit-1 Part-1Programming in python Unit-1 Part-1
Programming in python Unit-1 Part-1
 
Python Data types like mutable and immutable
Python Data types like mutable and immutablePython Data types like mutable and immutable
Python Data types like mutable and immutable
 
unit1 python.pptx
unit1 python.pptxunit1 python.pptx
unit1 python.pptx
 
An Introduction to Tuple List Dictionary in Python
An Introduction to Tuple List Dictionary in PythonAn Introduction to Tuple List Dictionary in Python
An Introduction to Tuple List Dictionary in Python
 
Python Programming and GIS
Python Programming and GISPython Programming and GIS
Python Programming and GIS
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
presentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptxpresentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptx
 
Getting started in Python presentation by Laban K
Getting started in Python presentation by Laban KGetting started in Python presentation by Laban K
Getting started in Python presentation by Laban K
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 

More from aiclub_slides

Linear regression middleschool
Linear regression middleschoolLinear regression middleschool
Linear regression middleschool
aiclub_slides
 
Pa2 project template
Pa2 project templatePa2 project template
Pa2 project template
aiclub_slides
 
Knn intro advanced_middleschool
Knn intro advanced_middleschoolKnn intro advanced_middleschool
Knn intro advanced_middleschool
aiclub_slides
 
M1 regression metrics_middleschool
M1 regression metrics_middleschoolM1 regression metrics_middleschool
M1 regression metrics_middleschool
aiclub_slides
 
Pa1 json requests
Pa1 json requestsPa1 json requests
Pa1 json requests
aiclub_slides
 
Mnist images
Mnist imagesMnist images
Mnist images
aiclub_slides
 
Mnist images
Mnist imagesMnist images
Mnist images
aiclub_slides
 
Ai in real life face detection
Ai in real life   face detectionAi in real life   face detection
Ai in real life face detection
aiclub_slides
 
Res net high level intro
Res net high level introRes net high level intro
Res net high level intro
aiclub_slides
 
Neural networks and flattened images
Neural networks and flattened imagesNeural networks and flattened images
Neural networks and flattened images
aiclub_slides
 
What is a_neural_network
What is a_neural_networkWhat is a_neural_network
What is a_neural_network
aiclub_slides
 
How neural networks learn part iii
How neural networks learn part iiiHow neural networks learn part iii
How neural networks learn part iii
aiclub_slides
 
Introduction to deep learning image classification
Introduction to deep learning   image classificationIntroduction to deep learning   image classification
Introduction to deep learning image classification
aiclub_slides
 
Accuracy middleschool
Accuracy middleschoolAccuracy middleschool
Accuracy middleschool
aiclub_slides
 
Introduction to classification_middleschool
Introduction to classification_middleschoolIntroduction to classification_middleschool
Introduction to classification_middleschool
aiclub_slides
 
Introduction to the cloud
Introduction to the cloudIntroduction to the cloud
Introduction to the cloud
aiclub_slides
 
Basics of data
Basics of dataBasics of data
Basics of data
aiclub_slides
 
Ai basics
Ai basicsAi basics
Ai basics
aiclub_slides
 
Ai lifecycle and navigator
Ai lifecycle and navigatorAi lifecycle and navigator
Ai lifecycle and navigator
aiclub_slides
 

More from aiclub_slides (20)

Linear regression middleschool
Linear regression middleschoolLinear regression middleschool
Linear regression middleschool
 
Pa2 project template
Pa2 project templatePa2 project template
Pa2 project template
 
Knn intro advanced_middleschool
Knn intro advanced_middleschoolKnn intro advanced_middleschool
Knn intro advanced_middleschool
 
M1 regression metrics_middleschool
M1 regression metrics_middleschoolM1 regression metrics_middleschool
M1 regression metrics_middleschool
 
Pa1 json requests
Pa1 json requestsPa1 json requests
Pa1 json requests
 
Mnist images
Mnist imagesMnist images
Mnist images
 
Mnist images
Mnist imagesMnist images
Mnist images
 
Ai in real life face detection
Ai in real life   face detectionAi in real life   face detection
Ai in real life face detection
 
Cnn
CnnCnn
Cnn
 
Res net high level intro
Res net high level introRes net high level intro
Res net high level intro
 
Neural networks and flattened images
Neural networks and flattened imagesNeural networks and flattened images
Neural networks and flattened images
 
What is a_neural_network
What is a_neural_networkWhat is a_neural_network
What is a_neural_network
 
How neural networks learn part iii
How neural networks learn part iiiHow neural networks learn part iii
How neural networks learn part iii
 
Introduction to deep learning image classification
Introduction to deep learning   image classificationIntroduction to deep learning   image classification
Introduction to deep learning image classification
 
Accuracy middleschool
Accuracy middleschoolAccuracy middleschool
Accuracy middleschool
 
Introduction to classification_middleschool
Introduction to classification_middleschoolIntroduction to classification_middleschool
Introduction to classification_middleschool
 
Introduction to the cloud
Introduction to the cloudIntroduction to the cloud
Introduction to the cloud
 
Basics of data
Basics of dataBasics of data
Basics of data
 
Ai basics
Ai basicsAi basics
Ai basics
 
Ai lifecycle and navigator
Ai lifecycle and navigatorAi lifecycle and navigator
Ai lifecycle and navigator
 

Recently uploaded

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
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
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
 
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
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
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
 
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
 
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
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
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
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 

Recently uploaded (20)

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
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
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
 
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
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
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
 
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
 
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
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
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
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 

Dictionaries

  • 1. AI Club Python with AI - I Dictionaries
  • 2. • A dictionary consists of two things (a) keys (b) values Dictionaries in python
  • 3. • A dictionary consists of two things (a) keys (b) values • Use strings to represent keys Dictionaries in python
  • 4. • A dictionary consists of two things (a) keys (b) values • Use strings to represent keys • Values can be anything Dictionaries in python
  • 5. • A dictionary consists of two things (a) keys (b) values • Use strings to represent keys • Values can be anything • There are many ways to create a dictionary, we will look at one way to do it: Dictionaries in python
  • 6. • A dictionary consists of two things (a) keys (b) values • Use strings to represent keys • Values can be anything Dictionaries in python
  • 7. Print the entire dictionary • Print(my_dict) • Please inspect the format in which it is printed. • Where do the : symbols show up?
  • 8. • Print(my_dict) • Please inspect the format in which it is printed. • Where do the colon (:) symbols show up? • Where do the commas (,) show up? Print the entire dictionary
  • 9. • Create a dictionary, where the keys are one, two and the corresponding values are 1 and 2 Exercise
  • 10. • Create a dictionary, where the keys are one, two and the corresponding values are 1 and 2 • Create a dictionary, where the keys are aiclub, PA1, M1 and the corresponding values are website, python class, AI class. Exercise
  • 11. Dictionaries in python • Print a value in a dictionary
  • 12. • Print values of the first dictionary you created • Print value corresponding to the key one • Print value corresponding to the key two Exercise
  • 13. • Print values of the first dictionary you created • Print value corresponding to the key one • Print value corresponding to the key two • Print values of the second dictionary you created • Print value corresponding to the key aiclub • Print value corresponding to the key M1 • Print value corresponding to the key PA1 Exercise
  • 14. Dictionaries in python • Print a value in a dictionary • Delete a value in a dictionary
  • 15. • Delete and print values of new dictionaries • For the first dictionary • Delete the value corresponding to the key one • Print the value of dictionary • For the second dictionary • Delete the value corresponding to the key aiclub • Print the value of dictionary Exercise
  • 16. Dictionaries in python • Print a value in a dictionary • Delete a value in a dictionary • Print all keys of a dictionary
  • 17. • Instead of printing the entire dictionary, please print only the keys of the two dictionaries you created Exercise
  • 18. Dictionaries in python • Print a value in a dictionary • Delete a value in a dictionary • Print all keys of a dictionary • Add values to a dictionary
  • 19. • Add the keys that you deleted from the 2 dictionaries back • Print the two dictionaries Exercise
  • 20. loops and dictionaries – use together • Loops - recap • The for loop is of the following form. • The range indicates the number of times a statement will be implemented. • There is a colon value to indicate the start of for loop. • The code below is executed many times. The number of times it gets executed depends on the values specified in range. • Note that the code below the for statement is indented.
  • 21. Loops - recap • The for loop is of the following form. • Try different values inside the brackets of range • Note that everything with indentation below for loop is executed as a part of the loop.
  • 22. • Exercise a) Create a random number in the limits 0 and 10 using a random number generator Loops and Dictionaries
  • 23. • Exercise a) Create a random number in the limits 0 and 10 using a random number generator b) Create a list of length 10 using the random number generator (pick any limits) – please use a loop Loops and Dictionaries
  • 24. Loops and Dictionaries • Exercise a) Create a random number in the limits 0 and 10 using a random number generator b) Create a list of length 10 using the random number generator (pick any limits) – please use a loop c) Now create a dictionary using the values of the list as keys and the corresponding values for each key can be another random number (pick any limits).
  • 25. • A list holds ordered collection of items. • And item can be a string or a number Lists - recap
  • 26. Lists - recap • A list holds ordered collection of items. • And item can be a string or a number • An item can be a dictionary too
  • 27. • Create a dictionary dict_1 with keys one, two, three and values 1, 2 and 3 • Create a dictionary dict_2 with keys one, two and three and values I, II, III List of dictionaries - Exercise
  • 28. • Create a dictionary dict_1 with keys one, two, three and values 1, 2 and 3 • Create a dictionary dict_2 with keys one, two and three and values I, II, III • Create a list with these two dictionaries: list_dict = [dict_1, dict_2] List of dictionaries - Exercise
  • 29. • Create a dictionary dict_1 with keys one, two, three and values 1, 2 and 3 • Create a dictionary dict_2 with keys one, two and three and values I, II, III • Create a list with these two dictionaries: list_dict = [dict_1, dict_2] • Print the value corresponding to the key one of first dictionary dict_1 from the list list_dict List of dictionaries - Exercise
  • 30. • Create a dictionary dict_1 with keys one, two, three and values 1, 2 and 3 • Create a dictionary dict_2 with keys one, two and three and values I, II, III • Create a list with these two dictionaries: list_dict = [dict_1, dict_2] • Print the value corresponding to the key one of first dictionary dict_1 from the list list_dict • Print the value corresponding to the key one of second dictionary dict_2 from the list list_dict List of dictionaries - Exercise