python检测质数程序

刚开始学python,写了一个简单的检测质数程序,随着学习的深入会渐渐完善这个小程序。
# -*- coding: utf-8 -*-
numb = int(raw_input('please input number:'))
n = 0
m = int(numb/2+1)
zs = []
for x in range(2,m):
    y=numb%x
    if   y == 0:
        #print x
        zs.append(x)
        n = n + 1
if n == 0:
    print numb ,'is Prime number'
else:
    print numb ,'is not Prime number,and the approximate number is:'
    print zs

你可能感兴趣的:(python检测质数程序)