Python 36
[Python 100] Python 100
100
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
#
lower = int(input(": "))
upper = int(input(": "))
for num in range(lower,upper + 1):
# 1
if num > 1:
for i in range(2,num):
if (num % i) == 0:
break
else:
print(num)
: 1 : 100 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
[Python 100] Python 100
Dr.D
hah***[email protected]
num/2+1
#!/usr/bin/python # -*- coding: UTF-8 -*- lower = int(input(": ")) upper = int(input(": ")) n = 0 for num in range(lower, upper + 1): if num >1: for i in range(2,num/2+1): if num%i ==0: break else: print (num) n += 1 print lower,'',upper,'',nDr.D
hah***[email protected]
101***[email protected]
#!/usr/bin/python # -*- coding: UTF-8 -*- import numpy as np num=np.arange(101) for i in num[2:101]: c=0 mod1=[] mod1.append(np.mod(i,num[1:101])) c=np.count_nonzero(mod1) if(np.size(mod1)-c <= 2): print i,101***[email protected]
bihar
sbh***163.com
#!/usr/bin/python # -*- coding: UTF-8 -*- for i in range(2,100): if 0 not in [i%n for n in range(2,i)]: print i,bihar
sbh***163.com
382***[email protected]
Python2.x Python3.x
import math def is_prime(n): for i in range(2,int(math.sqrt(n))+1): if n%i==0: return False else: return True if __name__ == "__main__": primes = [i for i in range(2,100) if is_prime(i)] print(primes)382***[email protected]
ng
409***[email protected]
python2 python3
# -*- coding: UTF-8 -*- a = [] for i in range(2, 101): for j in range(2, 101): if i * j <= 100: a.append(i * j) b = set(a) c = set(range(1, 101)) d = c - b print(d)ng
409***[email protected]