{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Name mydictferret mydictferret value key curly braces

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ue, use key as index. name = myDict["ferret"] myDict["ferret"] value key Curly braces {} indicate a dictionary {} is the empty dictionary. Use square brackets for indexing, just like a list. Structure of Database Program Part 1: Reads in data, builds a data structure. Usually has to read whole file. Can be very slow, but only done once. Using a Dictionary Initialize the empty dictionary: dataBase = {} Add values, use key as "index" dataBase[name] dataBase[name] = district Look up values using key as "index" district = dataBase[name] dataBase[name] Test if key is used in dictionary name in dataBase Part 2: gets and...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online