CS 1301 Chapter Notes - Chapter 20: Call Graph, Memoization

36 views1 pages

Document Summary

Mapping type- data type comprised of collection of keys and associated values; python"s built- in mapping type is dictionary. Dictionaries- another kind of compound type; python"s built in mapping type; map keys, which can be immutable type, to values, which can be any type just like elements of list or tuple. Keys- immutable type; data item that is mapped to value in dictionary; used to look up values in dictionary; each key must be unique across dictionary. Key: value pairs- adding these to empty dictionaries. 20. 2 dictionary methods: del- statement removes key: value pair from dictionary, len- function also works on dictionaries; returns number of key: value pairs. View- object with similarities to range object we saw earlier: values- returns view object which can be turned into list. Item- also returns view, which promises list of tuples; one tuple for each key: value pair. In and not in- test if key is in dictionary.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents