Learn practical skills, build real-world projects, and advance your career
Created 5 years ago
#to list all prime no between range
index1=int(input("Enter the lower range"))
index2=int(input("Enter the upper range"))
print("prime numbers between {0} and{1} are".format(index1,index2))
for num in range(index1,index2+1):
if (num>1):
isDivisible=False
for i in range(2,num):
if(num%i==0):
isDivisible=True
if not isDivisible:
print(num)
Enter the lower range2
Enter the upper range6
prime numbers between 2 and6 are
2
3
5
#to check whether it is prime no or not
num= int(input("Enter the number:"))
isDivisible =False
i=2
while i<num:
if num%i==0:
isDivisible=True
print("{} is divisible by {}".format(num,i))
break
i+=1
if isDivisible:
print("{} is NOT a prime number".format(num))
else:
print("{} is a prime number".format(num))
!pip install jovian -q
import jovian
jovian.commit()