Question: Please correct my answer. In my answer, some numbers are repeated which is not necessary. Please do not use any difficult codes. I am still
Please correct my answer.
In my answer, some numbers are repeated which is not necessary.
Please do not use any difficult codes. I am still a beginner, so please make correction as few as possible.
The question is
Write a Python program that generates a random integer number n1 in the range [50, 100] and another random integer number n2 in the range [200, 300], and finally prints all the numbers in the range [n1, n2] that are NOT prime number.
My answer is
import random n1=random.randint(50,100) print('n1=',n1) n2=random.randint(200,300) print('n2',n2) for i in range (n1,n2): for j in range (2,i): a=i%j if a==0: print(i) else: break
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
