+ 1
How can I create numbers from 1 to 100 without squred numbers?
5 Réponses
+ 4
import math
numList =[]
allNum=range(100)
for i in range(100):
if math.sqrt(i) not in allNum:
numList.append(i)
print(numList)
+ 1
Nums=list(range(1,101))
print(nums)
0
Ido, you need your range to start at 1 and end at 101 to get 1-100..
0
yes, but 1 and 100 are squerd. Try to run my code and see if it o.k. :)
0
kewl