CISC 121 Lecture Notes - Lecture 4: Standard Streams
CISC 121 verified notes
4/38View all
Document Summary
That said, it"s probably more common for a program to need to determine whether or not a specific value is associated with a known key, as in. Removing a key:value pair from dict is done with del, which was seen earlier. search_surname = smith" my_info = { surname":"linley", found = my_info[ surname"] == search_surname. After this, found has value false del my_info[ birth_year"] You may need to group similar dictionaries in a list (i. e. for database applications), where a database table might be read into a list of dictionaries. A tuple is a collection of comma-separated data elements usually (but not necessarily) surrounded by round brackets. Dictionaries can contain dictionaries and lists; lists can contain lists and dictionaries. Nesting these structures too deeply within one another can cause difficulty retreiving data from the layers for programmers, but it can be done.