COMP 102 Lecture 8: Comp102-Week8

9 views2 pages

Document Summary

The principle that spam algorithms use to sort through junk mail in your inbox. Counting is at the heart of very sophisticated algorithms. Whenever we are in a list, we can (as in line 12 of count_the. py), we have a loop that goes through every item in the list. If item matches what you want, counter goes up by one. String cleaning (or data cleaning ) removes symbols that aren"t of interest. Square brackets is how python gets something out of a list. Can use square brackets even to pull out the first element in a list. = a[0] how you pull the first element out of a string. The zeroth position is always the first element. The square bracket with the zero is called the accessor. Square brackets can also be used to pull a value out of a dictionary. A well designed programming languages should make intuitive sense based on what you already know about it.

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