## ## Exercise: ## ## Define a function that takes a list of numbers and a number and ## returns the list of all elements that are greater than the given ## number. ## def greater_than_list (inlist, num): outlist = [] for element in inlist: if element > num: outlist = outlist + [element] return outlist ## To test: print "[], 10", greater_than_list([], 10) print "[1, 2, 3, 4, 5], 10", greater_than_list([1, 2, 3, 4, 5], 10) print "[1, 11, 45, 3, 564], 10", greater_than_list([1, 11, 45, 3, 564], 10)