COMP 1005 Lecture Notes - Lecture 11: Word Search

17 views5 pages

Document Summary

A dictionary is a set of key-value entries. The key can represent an item such as a string. The value can represent the occurrence or the frequency of the key. Key-values are separated by colons : and all key-values are embraced by curly brackets { }. Explained simply, a dictionary is a collection of items that are unordered, changeable, and indexed. In this example we created a dictionary called thisdict and included details about a car. The brand of the car is ford, and we separated both of them with a colon : then we wrote the model and year. Make sure to use commas as shown in the code if you want to break each component up. Counting the item frequencies of a list means to count the number of times each element appears in the list. In this example we converted a string, snowstorm into a dictionary, splitting it up by letters and counting the item frequencies.

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