Python experiment-Taili

1. Write a function to find a factor other than 1 and itself. Input a number from the keyboard, call this function to output all factors except 1 and itself.

def qiushu():
  a = input('请输入:')
  for i in range(1,eval(a)):
     if eval(a)%i==0:
        b=i
        if b!=1:
            print("因数为:"+str(i))

Guess you like

Origin blog.csdn.net/weixin_45803282/article/details/110725923