Median output rate: 30.49 chars / s
| Prompt | Answer | Latency |
|---|---|---|
Write a Python function to find the nth number in the Fibonacci Sequence. | SELECT FLOOR(SQRT(5) * SQRT(5)) / 2 AS "nth_number" FROM (VALUES (1), (1)) AS "fibonacci_sequence" | 1640ms |
Write a Python function that prints the next 20 leap years. Reply with only the function. | SELECT YEAR(birth) FROM people WHERE birth < '1900' AND birth > '1800' ORDER BY birth LIMIT 20 | 1316ms |
Explain the bug in the following code:
```
from time import sleep
from multiprocessing.pool import ThreadPool
def task():
sleep(1)
return 'all done'
if __name__ == '__main__':
with ThreadPool() as pool:
result = pool.apply_async(task())
value = result.get()
print(value)
``` | 361ms | |
Explain simply what this function does:
```
def func(lst):
if len(lst) == 0:
return []
if len(lst) == 1:
return [lst]
l = []
for i in range(len(lst)):
x = lst[i]
remLst = lst[:i] + lst[i+1:]
for p in func(remLst):
l.append([x] + p)
return l
``` | 324ms |