- The following function is supposed to prompt the user for numbers until they enter a blank line, then it tells the user how many of the numbers were less than zero. Unfortunately, the function has two problems and doesn't work correctly. Identify and fix the two problems. def neg_count(): input = raw_input("Enter a number: ") below = 0 while input != "": if input < 0: below += 1 input = raw_input("Enter a number:") print "Below: " + below - Write a function called my_startswith that takes two strings as parameters and returns True if the first string startswith the second string. You may NOT use the built-in startswith method. You may assume that the second string is shorter than the first. - Rewrite each of the bool expressions below more compactly. For example, rather than writing x and x we could just write x ---------------------------- # x contains some bool value True and x # x contains some bool value False or x y > 0 and y < 10 (y > 0 and z == 1) or (y > 0 and z == 2) - Draw below what the following program would draw on the screen: from turtle import * def draw_something(x, y, length): pu() goto(x, y) pd() goto(x + length, y) for i in range(10): draw_something(0, i*5, i*5) - For each of the statements below state whether an error would occur OR state what would be printed out. Make sure to make it clear whether you have printed an int, float or a string. print 2 + 5.5 print 15 / 2 print float(15 / 2) print 2 + '3' print str(2) + '3' - Write a function called random_test that takes three parameters: an int called max, an int called threshold and an int called num. The function should generate num random numbers between 0 and max (inclusive) and return the number of these values that were less or equal to the threshold. - File processing question If I have a file called "data.txt" that has the following data in it: A 0 B 1 C 2 D 3 E 4 What would the following program print out? def process_file(filename): file = open(filename, "r") for line in file: line = line.strip() data = line.split() print data[0] * int(data[1]) process_file("data.txt") - What would the following function return if we called it with 4 as the parameter: def mystery(x): count = 1 total = 0 while count < = x: total += count * count return total