Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,24 @@ CODE_SNIPPETS = [
|
|
18 |
return sum(1 for e in elements if e > threshold)""",
|
19 |
"""def find_min_max(elements):
|
20 |
return min(elements), max(elements)"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
]
|
22 |
|
23 |
# 全局服务状态
|
|
|
18 |
return sum(1 for e in elements if e > threshold)""",
|
19 |
"""def find_min_max(elements):
|
20 |
return min(elements), max(elements)"""
|
21 |
+
"""def count_evens(nums):
|
22 |
+
return len([n for n in nums if n % 2 == 0])""",
|
23 |
+
"""def reverse_string(s):
|
24 |
+
return s[::-1]""",
|
25 |
+
"""def is_prime(n):
|
26 |
+
if n < 2:
|
27 |
+
return False
|
28 |
+
for i in range(2, int(n**0.5)+1):
|
29 |
+
if n % i == 0:
|
30 |
+
return False
|
31 |
+
return True""",
|
32 |
+
"""def factorial(n):
|
33 |
+
result = 1
|
34 |
+
for i in range(1, n+1):
|
35 |
+
result *= i
|
36 |
+
return result""",
|
37 |
+
"""def sum_of_squares(nums):
|
38 |
+
return sum(map(lambda x: x**2, nums))"""
|
39 |
]
|
40 |
|
41 |
# 全局服务状态
|