mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
Update builtins.h
This commit is contained in:
parent
ee1f8091c7
commit
15a9ec0689
@ -146,6 +146,27 @@ class dict:
|
||||
a.append(k.__json__()+': '+v.__json__())
|
||||
return '{'+ ', '.join(a) + '}'
|
||||
|
||||
def max(a, b):
|
||||
if a > b:
|
||||
return a
|
||||
return b
|
||||
|
||||
def min(a, b):
|
||||
if a < b:
|
||||
return a
|
||||
return b
|
||||
|
||||
def sum(iterable):
|
||||
res = 0
|
||||
for i in iterable:
|
||||
res += i
|
||||
return res
|
||||
|
||||
def map(f, iterable):
|
||||
return [f(i) for i in iterable]
|
||||
|
||||
def zip(a, b):
|
||||
return [(a[i], b[i]) for i in range(min(len(a), len(b)))]
|
||||
)";
|
||||
|
||||
const char* __RANDOM_CODE = R"(
|
||||
|
Loading…
x
Reference in New Issue
Block a user