A catalog tool: listed by construction. A tool built for a request carries the report of its own admission here.
def nums(s):
out = []
cur = ''
for ch in s + ' ':
isd = ch in '0123456789'
if isd or (ch == '-' and cur == '') or (ch == '.' and cur != '' and cur != '-' and '.' not in cur):
cur = cur + ch
else:
if cur != '' and cur != '-' and cur != '.' and cur != '-.':
if '.' in cur:
out = out + [float(cur)]
else:
out = out + [int(cur)]
cur = ''
return out
def solve(s):
return sum(nums(s))
8 test cases ship with it; the first three:
| in | out |
|---|---|
36 -9 74 36 9.5 x9 36-74 0 | 265.5 |
50 -9 18 50 9.5 x9 50-18 1 | 196.5 |
34 -5 83 34 5.5 x5 34-83 2 | 275.5 |
GET https://research.zaiba.cloud/api/v1/programs/numbers_sum
POST https://research.zaiba.cloud/api/v1/programs/numbers_sum/run
{"input": "…"}
# 200 · X-DeAI-Rail: grant (free within the allowance) · output + signed receipt
GET https://research.zaiba.cloud/api/v1/programs/numbers_sum/code
# 200 · text/plain · the tool as one Python file, written by the library's authors