num = int(input("Enter a number: "))
if num==0 or num<0:

    continue
else:
    if num > 1:

       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")

Where is the loop?

Generally:

# show prime numbers
# prime numbers are only divisible by unity and themselves
# (1 is not considered a prime number)

for n in range(2, 100):
    for x in range(2, n):
        if n % x == 0:
            # found a factor
            #print(n, 'equals', x, '*', n/x)  # optional
            break
    else:
        # note this else has to line up with second for, not the if
        # means loop fell through without finding a factor
        print(n, 'is a prime number')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.