CS 130R: Programming in Python - Emory University
CS 130R: Programming in Python #10: Dictionary
Reading: Chapter 5
? Dictionary
Contents
Dictionary
Dictionary - a reference source in print or electronic form containing words usually alphabetically arranged along with information about their forms, pronunciations, functions, etymologies, meanings, and syntactical and idiomatic uses.
Electronic dictionary: Cat --- Scientific name: felis catus. A cat is a small,
meat-eating animal that is often kept as a pet.
word ~ definition, picture
Python --- Scientific name: genus: python. Pythons are nonvenomous snakes that usually kill their prey by wrapping around them and suffocating them.
Dictionary
Dictionary ? is a list of pairs (word ~ definition) Python dictionary ? is a list of pairs (key : value) ? The Python dictionary works the same way as the
actual dictionary - you look up a key and get its value(s). ? The idea is to organize information for fast retrieval. ? Very efficient implementation.
Dictionary
? A Python dictionary is an extremely useful data storage construct for organizing information in pairs (key: value). The association of a key and a value is called a key-value pair or an item.
? Analog to a hashtable in Java. A hash is a function that takes a value (of any kind) and returns an integer (that is the memory location of the key). Dictionaries use these integers, called hash values, to store and look up key-value pairs.
? The difference is that in Python the key can be any immutable type (string, number, tuple).
? Any key is a unique string, number or tuple. A key can have associated one or more values in a list. The values of a dictionary can be any Python data type.
? Since dictionaries are mutable, they can't be used as keys, but they can be used as values.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python iterate nested dictionary key value
- functional programming
- python iterate dictionary value list
- cs 130r programming in python emory university
- python programming exercises 4
- module 19 cornell university
- python declare dictionary add key value pair
- programming principles in python csci 503
- python programming techniques eliot
Related searches
- macro programming in excel
- programming in excel
- programming in java pdf
- sort dictionary in python by values
- programming in matlab
- object oriented programming in matlab
- programming in basic
- emory university cme courses
- database programming in java
- database programming in python
- run python script in python shell
- object oriented programming in python