Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check if number is prime

def check_if_prime():
    number = int(input("Enter number: "))
    
    prime_lists = [1,2,3]
    
    divisible_by = []
    if number in prime_lists:
        return divisible_by
    
    if number==0:
        return None
    
    for i in range(2,number):
        
        if number%i==0:
            divisible_by.append(i)
            
    return divisible_by
        
    
check_if_prime()
 
PREVIOUS NEXT
Tagged: #check #number #prime
ADD COMMENT
Topic
Name
2+3 =