mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Merge branch 'main' of https://github.com/blueloveTH/pocketpy
This commit is contained in:
commit
b8f7491cd7
@ -44,6 +44,12 @@ def any(iterable):
|
||||
return True
|
||||
return False
|
||||
|
||||
def enumerate(iterable, start=0):
|
||||
n = start
|
||||
for elem in iterable:
|
||||
yield n, elem
|
||||
n += 1
|
||||
|
||||
def sum(iterable):
|
||||
res = 0
|
||||
for i in iterable:
|
||||
|
@ -199,3 +199,6 @@ assert all([True, 1])
|
||||
assert not all([False])
|
||||
assert not all([True, False])
|
||||
assert not all([False, False])
|
||||
|
||||
assert list(enumerate([1,2,3])) == [(0,1), (1,2), (2,3)]
|
||||
assert list(enumerate([1,2,3], 1)) == [(1,1), (2,2), (3,3)]
|
Loading…
x
Reference in New Issue
Block a user