# CSCA08 Lecture 10: Week 10 Notes

41 views8 pages
School
Course
Professor

## Document Summary

Up until now we"ve been concentrating on creating correct functions. Print_odd_ints executes the function roughly n/2 times, printing every odd integer from 1 to n: this is also a linear function, though the slope is halved (eg. 20 steps when n is 40). Print_double_step prints integers from 1 to n, taking a step size that starts off at 1 and doubles every subsequent step. Linear search: search items one by one in a list: if we use the help(list. index) we see that it nds the rst occurrence of an item. So if a" appears at index 0 and 4, it will still return 0, since that is the rst occurrence. This is because this method searches the list linearly, starting at index 0, moving to 1, then 2, and. Csc108h1f 2014 so on towards the end of the list until the rst occurrence is found.

## Get access

\$8 USD/m\$10 USD/m
Billed \$96 USD annually Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class 