UNIT 4A Iteration: Searching
UNIT 4A Iteration: Searching
15110 Principles of Computing, Carnegie Mellon University
1
Last Course
? Algorithms ? Sieve of Eratosthenes
15110 Principles of Computing, Carnegie Mellon University
2
Function calls and parameters
def getSumOf (numList, start, end): sum = 0 for pos in ranges(start, end): sum = sum + numList[pos] return sum
>>> start = "This is a program to ... " >>> numbers = [3, 6, 8, 2, 5, 7] >>> sum = getSumOf(numbers, 1, 5) >>> sum = sumOf (3, 6, 8, 2)
def sumOf (a, b, c, d): sum = a + b + c + d return sum
Are these sum variables same?
15110 Principles of Computing, Carnegie Mellon University
4
What Does Your Code Say About You?
def linsearch(items, key): # search for key in items ln = len(items) i = 0 while i < ln: if items[i] == key: return i i = i + 1 return None
15110 Principles of Computing, Carnegie Mellon University - CORTINA/ANDERSON
4
What Does Your Code Say About You?
def linsearch (fred ,x): ln =len(fred)
v= 0 while v ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python programming an introduction to computer science
- programming for gcse topic 6 1 lists arrays and for loop
- unit 4a iteration searching
- python programing an introduction to computer science
- exploring data using python 3 charles r severance
- python functions stanford university
- iterate python list while loop tutorial kart
Related searches
- another word for searching for
- reverse searching and ad picture
- best car searching sites
- python searching list of dictionaries
- best college searching websites
- searching synonym
- people searching for jobs
- best job searching websites
- 2020 louisiana class 4a high school football
- searching for answers synonyms
- searching for text in word
- searching words in pdf