# Tasks def location( (xs, key) : Wc will implement our own function...

## Transcribed Text

Tasks def location( (xs, key) : Wc will implement our own function-version of the index() method (which you may not call). Search through the list xs, and when you find a value equivalent to key, return that non-negative index. When it's not found, return the None value. The leftmost match is reported when multiple matches of the key are present assume that xs is a list. Restriction can't call .index() method - just loop through manually and seck the key Examples location( [5,10,15,20,25], 15) 2 location( [3,4,5,6,4,4,4,4,4], 4) 1 location( [100, 105, 110], 234) None def fibonacci(n): The fibonacci sequence begins with two 1's, and cach successive spot is the sum of the previous two. If we were to store those values in a list. it would begin ast fibs = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, *** ] Given an index into that list, n, report the nth fibonacci number. Note though there is a well-known recursive solution, it is well-known because it is pathologically slow! Wc have one larger test-case that will somewhat require that you use a loop-based solution. Restriction no recursion. Examples fibonacci(0) 1 fibonacci(7) 21 fibonacci(15) 987 def int_sqrt(n): Find the largest integer whose square isn't bigger than the parameter n. assume that n is a positive integer. Restriction: you may not import or use math. sqrt Examples int_sqrt(9) 3 # 3*3 happens to perfectly equal 9. int_sqrt(25) 5 # 5*5 is the largest Square not larger than 25 int_sqrt(26) 5 # n:25 35 all answer with 5. int_sqrt(36) 6 # 6*6 happens to perfectly equal 36. def sum_evens_2d(xss): Given a "two-dimensional list" of integers - that is, a list where each value in it is a list of integers - find all the even numbers and sum them together. You will need more than a single loop for this! assume that xss is a list where cach value is a list of integers. Restriction: you may not call sum(). (It would have included the odds anyways). Examples sum_evens_2d ([[1,2,3],[4,5,6]]) 2+4+6 == 12 sum_evens_2d([[1,3,51,[7,9,11]1) sum_evens_2d([[1,2,31,[4,51,[61,[7,8,9]]) 2+4+6+8 == 20

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

def location(xs, key):
for i in range(len(xs)):
if xs[i]== key:
return i
return None...

By purchasing this solution you'll be able to access the following files:
Solution.py.

\$40.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.