# Commits

committed 6622b3f

fifth form of kata

• Participants
• Parent commits 74538b8

# File five/chopper.py

` import math`
` `
` `
`+class Chop:`
`+`
`+	def __init__(self,values):`
`+		self.values = values`
`+		`
`+	def break_me(self, value ,start , stop ):`
`+	`
`+		#print "value %i , start %i , stop  %i values %s"%(value ,start , stop,str(self.values) )`
`+	`
`+		if len(self.values[start:stop]) < 3:`
`+			return self.values[start:stop]`
`+		else:`
`+			if self.values[0] < value:`
`+				start = start+1`
`+			if self.values[stop-1] > value:`
`+				stop = stop - 1`
`+		`
`+			return self.break_me(value,start,stop)`
`+		`
`+	def i_got_it(self,value):`
`+	`
`+		if len(self.values) == 0:`
`+			return -1`
`+		else:`
`+			out = filter((lambda x: x==value ), self.break_me(value,0, len(self.values)))`
`+			`
`+			if len(out) == 0:`
`+				return -1 `
`+			else:`
`+				return self.values.index(out[0]) `
`+			 `
`+			`
`+`
` def chop(value_to_find,values):`
`-   pass`
`+   ck = Chop(values)`
`+   return ck.i_got_it(value_to_find)`

# File tests.py

`         from four.chopper import chop as chop_four`
`         self.chop_kata_moves(chop_four)`
` `
`+		`
`+    def test_chop_five(self):`
`+        from five.chopper import chop as chop_five`
`+        self.chop_kata_moves(chop_five)	`
`+`
` `
` if __name__ == '__main__':`
`     unittest.main()`