mercredi 25 avril 2018

How do i check if the number is semi prime

def SPOEchecker():
    num = int(input("Enter a number to find out if its prime/semiprime or not\n>>> "))

       if num > 1:
        # check for semiprime
        for i in range(1,num):
           if (num % i) == 0:  ##i think i need to change this some how
                print(num,"is not a semiprime number")
                print(i,"times",num//i,"is",num)
                break
        else:
            print(num,"is a semiprime number")

    # if input number is less than
    # or equal to 1, it is not semiprime
    else:
        print(num,"is not a semiprime number")

SPOEchecker()

Right now it is checking if the number is prime how do i check if its semiprime

Aucun commentaire:

Enregistrer un commentaire