Home > database >  Python questions please
Python questions please

Time:10-09

Within 100 integer meet:
An odd number of different factors

CodePudding user response:

 
Def getFactor (num) :
Factor=0
For I in range (1, num + 1) :
If (num % I==0) :
Factor +=1
The return factor if factor!
=0 else - 1
DataList=[] # stored the results
# 1-99 traversal
For I in range (1, 100) :
Factor=getFactor # (I) to obtain the factor number
If factor % 2==1:
The dataList. Append (I)

Print (dataList)

  • Related