Lepsi stahovani informaci o pocasi
This commit is contained in:
@@ -12,3 +12,10 @@ def chunks(items: list | dict, n: int) -> typing.Generator:
|
||||
it = iter(items)
|
||||
for i in range(0, len(items), n):
|
||||
yield {k: items[k] for k in islice(it, n)}
|
||||
|
||||
|
||||
def evenly_spaced_elements(lst: list, count: int) -> list:
|
||||
if count > len(lst):
|
||||
return lst
|
||||
interval = (len(lst) - 1) / (count - 1) if count > 1 else 0
|
||||
return [lst[int(round(i * interval))] for i in range(count)]
|
||||
|
||||
Reference in New Issue
Block a user