We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 755720f commit 72bdff2Copy full SHA for 72bdff2
day06/code/practice3.py
@@ -8,7 +8,7 @@
8
from math import sqrt
9
10
def is_prime(num):
11
- for i in range(2, int(sqrt(num))):
+ for i in range(2, int(sqrt(num)) + 1):
12
if num % i == 0:
13
return False
14
return True if num != 1 else False
day06/index.md
@@ -189,10 +189,13 @@ Date: 2019-05-22
189
190
191
192
193
194
195
196
+
197
+n = int(input("输入 n:"))
198
+print(is_prime(n))
199
```
200
201
知识点:`return True if num != 1 else False` 简洁写法
0 commit comments