This preview shows page 1. Sign up to view the full content.
Unformatted text preview: y words. But, "", "XX", "DDXXXD", "ZZZ" are not. Write a function is_wacky_word that consumes a string, s, and produces True if s is a wacky word, and False otherwise. 3. Write a function kth_smallest that consumes a nonempty list of integers, L (which may contain duplicate values) and a positive integer, k, and (using the approach described below) produces the kth smallest entry in L, for any k satisfying 1 ≤ k ≤ len(L). For example, • kth_smallest([8,7,10,6,9], 1) => 6 and • kth_smallest([8,7,10,6,9], 4) => 9. Because L may contain duplicate values, your function may produce the same answer for different values of k. For example, if M=[9,2,2,9,2], then kth_smallest(M, x) pro...
View
Full
Document
This document was uploaded on 01/19/2014.
 Winter '14
 Recursion

Click to edit the document details