Download presentation
Presentation is loading. Please wait.
1
COSC 1323 – Computer Science Concepts I
Python Dictionaries COSC 1323 – Computer Science Concepts I
2
Dictionary Description
A list is a sequence of indexed objects. Each item has an associated index number Unlike a list, a dictionary is indexed by keys, which can be any immutable type (i.e., the key cannot be changed) Think of dictionaries as an unordered set of key:value pairs In other languages, dictionairies may be called “associative arrays”
3
Dictionary Description
A pair of braces creates an empty dictionary: {} Placing a comma-separated list of key:value pairs within the braces adds initial key:value pairs to the dictionary\ The main operations on a dictionary are storing a value with some key and extracting the value given the key To check wether a single key is in the dictionary, use the ‘in’ keyword
4
Dictionary Examples es.txt
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.