#Write a function div_3 that has one parameter, integer number. The #function returns True if the parameter is divisible by 3 and False #otherwise. #Write a program that ask user to enter how many numbers to #generate in range -20 to 20. #Print each integer. For each integer, the program uses function div_3 to #check divisibility by 3. Find the total number of integers #divisible by 3 out of ALL randomly generated numbers. Use function random #library. Add import random to your program. Use function #randint(min_range, max_range) with the following syntax: #random.randint(-20, 20) #Example: Assume that user enters 5 and program generates 5 integers # 4 -5 20 -20 6 #Output: # 4 is NOT divisible #-5 is NOT divisible #20 is NOT divisible #-20 is NOT divisible #6 is divisible #total = 1 import random def div_3(num): if(num%3==0): return True else: return False def main(): size=int(input("how many ints to generate? ")) counter=1 total=0 while(counter<=size): num=random.randint(-20,20) print(num) result=div_3(num) if(result==True): print(num, "divisible by 3") total=total+1 else: print(num, "is NOT divisible by 3") #alternatively #if(div_3(num): # print(num, "divisible by 3") # total=total+1 #else: # print(num, "is NOT divisible by 3") counter=counter+1 if(total>0): print("there are", total, "numbers divisible by 3") else: print("No numbers divisible 3") main()