1) Define a function lt(m), which generates a list of m random integers between 1 and 200. The function is to generate a list of m random integers between 1 and 200. 2) Define a function prime(n) to determine whether the integer n is prime. 3) Use the LT function to generate a list LS composed of 12 positive integers between 1 and 200, then use the prime function to find out the prime number in the list and output it. At the same time, calculate the sum of prime numbers and output it. The display format is as follows (the randomly generated data will be different, refer to the output format) :
Import random # def prime(n): flag= trueFor I in range(2,n): if n% I ==0: Return 1 # Generate m random numbers in the range [1-200] and place them in the list < def < (m): Ls =[rand.randInt (1200) for I in range(m)] return ls # generate a list of 12 positive integers between 1 and 200 ls=lt(12)# list of 12 random numbers ls Print (" for I in ls ")#end="" print(" for I in ls ")#end="" Print (I,end=" ") print(I,end=" ") print(I,end=" ") print(I,end=" ") print(I,end=" ")