#Write a program that prompts the user for a list of strings and an #integer, and then prints a list of all of the elements of the list #whose length is greater than the integer. First, complete the #following function according to the docstring description. Then, #write a main program that calls your function. def q1_correct(lst,x): '''Given a list of strings lst, return a new list that contains each element of lst whose length is greater than int x. For example, longer(['abcd','abc','ab],2) returns ['abcd','abc']''' # We'll learn how to print interesting output soon! print "running q1_correct(%s,%d)" % (str(lst),x) new = [] for s in lst: if len(s) > x: new.append(s) return new def input_list(): # x = raw_input("Enter a list of strings ") # try in the shell: list(x). Not what we want! il = [] x = raw_input("enter a string to add to the list ") while x: il.append(x) x = raw_input("enter a string to add to the list ") return il if __name__ == '__main__': x = q1_correct(['abcde','fff','f','qqq','1234567','jj','kkkk'],3) print x x = input_list() y = raw_input("Enter an integer ") print q1_correct(x,int(y)) #here are some addition test cases of the function x = q1_correct(['abcde','fff','f','qqq','1234567','jj','kkkk'],2) print x,"sb",['abcde','fff','qqq','1234567','kkkk'] lst = ['a','fffff','qqqaa','1111111111','33333'] length = 2 new_list = q1_correct(lst,int(length)) print new_list, "sb", ['fffff','qqqaa','1111111111','33333']