r/PythonLearning • • Aug 27 '25

Help

Post image

Where is the problem

17 Upvotes

22 comments sorted by

View all comments

1

u/FanUpstairs8699 Aug 27 '25

i think this works

n=int(input("enter a number"))
is_prime = True
for i in range(2,n):
    if n%i==0:
        is_prime = False
        break
if n == 1 or n == 2:
    print("neither")
elif is_prime:
    print("Prime")
else:
    print("Not prime")