Jovian
⭐️
Sign In
In [17]:
#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
In [ ]:
#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))
In [ ]:
!pip install jovian -q
In [ ]:
import jovian
In [ ]:
jovian.commit()
In [ ]:
import jovian
In [ ]:
import jovian
In [ ]:
jovian.commit()
In [ ]:
!rm -rf ~/.jovian
In [ ]:
!remove -rf~/.jovian
In [ ]:
!pip uninstall jovian
In [ ]:
!pip install jovian -q
In [ ]:
del ~/.jovian/credentials.json
In [ ]:
jovian.commit()
In [ ]:
import jovian 
In [ ]:
del ~/.jovian/credentials.json
In [ ]:
jovian.commit()
In [ ]:
import jovian
jovian.utils.credentials.purge_config()
In [ ]:
!pip install tensorflow -q
In [ ]:
import tensorflow   #if shows error while downloading then upgrade numpy and scikit pip install --upgrade numpy ansd scikit
In [ ]:
import keras
In [ ]:
import jovian
jovian.commit()
In [ ]:
import plotly
In [ ]:
!pip install Pillow -q
In [ ]:
import PIL
In [ ]:
num=31
for i in range (1,31):
    if (31%i==0):
        print(i)
In [ ]:
num=int(input("Enter the number"))
if num > 1:
   # check for factors
   for i in range(2,num):
        if (num % i) == 0:
            print(num,"is not a prime number")
            print(i,"times",num//i,"is",num)
            break
        else:
            print(num,"is a prime number")
# if input number is less than
# or equal to 1, it is not prime
else:
      print(num,"is not a prime number")
In [ ]:
def isMagic(n): 
    sum = 0; 
      
    # Note that the loop  
    # continues if n is 0  
    # and sum is non-zero. 
    # It stops when n becomes  
    # 0 and sum becomes single 
    # digit. 
    while (n > 0 or sum > 9): 
        if (n == 0): 
            n = sum; 
            sum = 0; 
        sum = sum + n % 10; 
        n = int(n / 10); 
          
    # Return true if 
    # sum becomes 1. 
    return True if (sum == 1) else False; 
  
# Driver code 
n = int(input()); 
if (isMagic(n)): 
    print("Magic Number"); 
else: 
    print("Not a magic Number"); 
In [ ]:
N=int(input())
print(N)
sum;
reverse;
def sum(N):
    while(N>0 or sum>9):
        if(N==0):
            n=sum;
            sum=0;
    sum=sum+N%10;
    N=int(N/10);
    return (sum)
print(sum)
def rev(N):
    rev=0
    while(sum>0):
        reminder=sum%10
        rev=rev*10+reminder
        sum=sum/10
    return (rev)


sum=sum(N)
reverse=rev(N)
print(reverse)
print(sum)
'''
print(m)
print(N)
if(N==m):
    print("Magic Number")
else:
    print("Not a Magic number")'''
In [ ]:
#Factors
num=int(input())
for i in range(1,num+1):
    if(num%i==0):
        print(i)

In [ ]:
#Factorial of a number
num=int(input())
product=1
for i in range(1,num+1):
    product =product*i
    
print(product)
In [ ]:
num=int(input())
product=1
for i in range(num,0,-1):
    print(i)
    product =product*i
print(product)
In [ ]:
#list prime nos
t=int(input())
d={}
for i in range(t):
    m=int(input("Enter lower range"))
    n=int(input("Enter upper range"))
for num in range(m,n+1):
    if (num>1):
        isDivisible=False
        for i in range(2,num):
            if(num%i==0):
                isDivisible=True
                break
        if not isDivisible:
            print(num)

In [ ]:
#list prime nos
t=int(input())
for i in range(t):
    lst=[]
    m,i+1=int(input("Enter lower range"))
    n,i+1=int(input("Enter upper range"))
for num in range(m,n+1):
    if (num>1):
        isDivisible=False
        for i in range(2,num):
            if(num%i==0):
                isDivisible=True
                break
        if not isDivisible:
            print(num)
In [ ]:
t=int(input())
for i in range(t):
    lst=[]
    lst.append(int(input("Enter lower range")))
    lst.append(int(input("Enter upper range")))
print(lst)
In [ ]:
t=int(input())
d={}
for i in range(1,t+1):
    lst=[]
    m=input("enter range")   
   # print(m)
    n=(m.split())
    #print(type(n))
    #print(int(n[0]))
    q,l=int(n[0]),int(n[1])
    #l=int(n[1])
    #print(type(q))
    lst.append(q)
    lst.append(l)
    #print(lst)
    d[i]=lst
#print(d)
    for num in range(q,l):
        if (num>1):
            isDivisible=False
            for i in range(2,num):
                if(num%i==0):
                    isDivisible=True
                    break
            if not isDivisible:
                print(num)
    
    
    
    
    
    
In [16]:
t=int(input())
d={}
for i in range(1,t+1):
    lst=[]
    m=input("enter range")
   # print(m)
    n=(m.split())
    #print(type(n))
    #print(int(n[0]))
    q,l=int(n[0]),int(n[1])
    #l=int(n[1])
    #print(type(q))
    lst.append(q)
    lst.append(l)
    #print(lst)
    d[i]=lst
print(d) 
for i in range(1,t+1):
    for num in range(d[i][0],d[i][1]):
        if (num>1):
            isDivisible=False
            #print(isDivisible)
            for j in range(2,num):
                #print(j)
                if(num%j==0):
                    isDivisible=True
                    break
            #print(isDivisible)
            if not isDivisible:
                print(num)
2 enter range2 6 enter range3 8 {1: [2, 6], 2: [3, 8]} 2 6 2 3 5 3 8 3 5 7
In [25]:
t=int(input())
d={}
for i in range(1,t+1):
    lst=[]
    m=input("enter range")
    n=(m.split())
    q,l=int(n[0]),int(n[1])
    lst.append(q)
    lst.append(l)
    d[i]=lst
for i in range(1,t+1):
    print("\n")
    for num in range(d[i][0],d[i][1]):
        if (num>1):
            isDivisible=False
            for j in range(2,num):
                if(num%j==0):
                    isDivisible=True
                    break
            if not isDivisible:
                print(num)
2 enter range2 6 enter range3 8 2 3 5 3 5 7
In [46]:
#print nth prime number
t=int(input())
lst=[]
count=0
for i in range(1,t+1):
    lst.extend(input("enter {} number".format(i)))
print(lst)
for c in lst:
    print(c)
    for num in range(2,100):
        if(num>1):
            isDivisible=False
            for j in range(2,num):
                if(num%j==0):
                    isDivisible=True
                    break
            if not isDivisible:
                count+=1
                print("hk")
                if(count==c):
                    print("hi")
                    print(num)
3 enter 1 number2 enter 2 number3 enter 3 number5 ['2', '3', '5'] 2 3 5
In [1]:
import jovian
In [ ]:
jovian.commit()
[jovian] Saving notebook..
In [ ]: