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.__header__
from typing import SupportsIndex
import cp_library.alg.__header__
import cp_library.alg.iter.__header__
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

_S = TypeVar('S'); _T = TypeVar('T'); _U = TypeVar('U'); _T1 = TypeVar('T1'); _T2 = TypeVar('T2'); _T3 = TypeVar('T3'); _T4 = TypeVar('T4'); _T5 = TypeVar('T5'); _T6 = TypeVar('T6')

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