Lab 07 Marked Assignment 3 Wednesday Solution

Lab 07 Marked Assignment 3 Wednesday Solution - # Design...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 # William M. Farmer # 9 November 2010 # # This is a solution for Lab 07: Marked Assignment 3 on Wednesday # Implements f_1 def fun1(n): return abs((n ** 2) - 2) # Implements f_2 def fun2(m,n): val = 0 for i in range(m, n + 1): val = val + (fun1(i) ** 2) return val # Implements f_3 def fun3(n): list = [] for i in range(1, n + 1): list = list + [fun2(5,i)] return list
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # Design Question # # Yes, this is a good approach. The function fun4 is more general and # more useful than fun3, but not any harder to write. And fun3 can be # immediately defined in terms of fun4: # # def fun3(n): # return fun4(5,1,n) # # Testing Question # # Inputs Expected Output # 10 98 # 1 1 # 0 2 # -1 1 # -10 98...
View Full Document

Ask a homework question - tutors are online