""" Write a program that generates a list of prices all prices between 0.1 and 1 for items sold in the dollar store. Find the number of items in the store that cost 30 cents or less and their average price. Use functions: def make_list_formatted(size, min, max) - generates list of FLOATING POINT NUMBERS def items30(my_list) returns number of items that cost 30 cents or less and their average. Write main to test your functions. """ import random def make_list_formatted(size, min, max): return [round(random.uniform(min,max),2) for i in range(size)] def items30(my_list): count_30cents=0 sum_30cents=0 for price in my_list: if(price<=0.3): count_30cents+=1 #count_30cents=count_30cents+1 sum_30cents+=price #sum_30cents=sum_30cents+price #if you want to create new list of items below 30 cents using list #comprehensions you can do: new_list=[price for price in my_list if price<0.3] if(count_30cents>0): return count_30cents, sum_30cents/count_30cents else: return None, None #nothing to return def main(): prices=make_list_formatted(10,0.1,1) print(prices) count, ave=items30(prices) if(count==None): print("no items below 30 cents") else: print("there",count,"items below 30 cents") print("Their average is", round(ave,2)) main()