+ 1

How can I create numbers from 1 to 100 without squred numbers?

7th Aug 2016, 6:18 PM
1604003_Eftikhar
1604003_Eftikhar - avatar
5 odpowiedzi
+ 4
import math numList =[] allNum=range(100) for i in range(100): if math.sqrt(i) not in allNum: numList.append(i) print(numList)
8th Aug 2016, 7:35 PM
‫Ido Tal
‫Ido Tal - avatar
+ 1
Nums=list(range(1,101)) print(nums)
25th Oct 2016, 6:05 PM
Hirak Dey
Hirak Dey - avatar
0
Ido, you need your range to start at 1 and end at 101 to get 1-100..
9th Aug 2016, 6:27 PM
Avihu Czapnik
Avihu Czapnik - avatar
0
yes, but 1 and 100 are squerd. Try to run my code and see if it o.k. :)
9th Aug 2016, 6:30 PM
‫Ido Tal
‫Ido Tal - avatar
0
kewl
9th Aug 2016, 6:33 PM
Avihu Czapnik
Avihu Czapnik - avatar