Ask a Teacher



wright a python program to check within the given number is prime or not.

number = int(raw_input( ))
if number < 2:
        print "the number" ,number,"is not prime!"
else:
    for d in range(2,(number/2)+1):
        if number%d = =0:
            print "the number",number,"is not prime!"
            break
        else:
            print "the number",number,"is prime."
            break



comments powered by Disqus