cp-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kobejean/cp-library

:warning: cp_library/alg/iter/sum_range_fn.py

Code

import cp_library.alg.iter.__header__
from typing import SupportsIndex
from cp_library.misc.typing import _T

def sum_range(A: list[_T], l: SupportsIndex, r: SupportsIndex, step: SupportsIndex = 1, /, initial: _T = 0) -> _T:
    for i in range(l,r,step): initial += A[i]
    return initial
'''
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
             https://kobejean.github.io/cp-library               
'''
from typing import SupportsIndex
from typing import TypeVar
_T = TypeVar('T')

def sum_range(A: list[_T], l: SupportsIndex, r: SupportsIndex, step: SupportsIndex = 1, /, initial: _T = 0) -> _T:
    for i in range(l,r,step): initial += A[i]
    return initial
Back to top page