#Exam 3 preparation #Problem 1 (this kind of problems will be 15% on the exam) #Write a function process that has one integer parameter, num, #function generates num random integers beteween -10 and 10 #function prints randomly generated data for testing purposes #function counts and returns the number of positives, negatives and zeros #Write main to test your function and print a category with most values: #for example, if we have 10 numbers that we generated, and we have #7 positives, 2 negatives and 1 zero, then the category with most values #will be positive numbers import random def process(num): count_pos=0 count_neg=0 count_zero=0 for i in range(num): random_num=random.randint(-10,10) print(random_num) if(random_num>0): count_pos+=1 elif(random_num<0): count_neg+=1 else: count_zero+=1 return count_pos, count_neg, count_zero def main(): num=random.randint(5,15) print("size of the data is", num) count_pos, count_neg, count_zero = process(num) print("there are", count_pos,"positives") print("there are", count_neg, "negatives") print("there are", count_zero, "zeros") if(count_pos>count_neg and count_pos>count_zero): print("positives have most values") elif(count_neg>count_pos and count_neg>count_zero): print("negatives have most values") elif(count_zero>count_pos and count_zero>count_neg): print("zeros have most values") elif(count_pos==count_neg and count_pos==count_zero): print("all categories have the number of values") elif(count_pos==count_neg and count_neg>count_zero): print("positives and negatives have the most values") elif(count_pos==count_zero and count_zero>count_neg): print("positives and zeros have the most") else: print("negatives and zeros have the most") main()