aboutsummaryrefslogtreecommitdiff
path: root/challenge-334/eric-cheung/python/ch-1.py
blob: 8f721b34a1443d8458646e6c9dba8ae9e82e11ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Example 1
## arrInts = [-2, 0, 3, -5, 2, -1]
## nX = 0
## nY = 2

## Example 2
## arrInts = [1, -2, 3, -4, 5]
## nX = 1
## nY = 3

## Example 3
## arrInts = [1, 0, 2, -1, 3]
## nX = 3
## nY = 4

## Example 4
## arrInts = [-5, 4, -3, 2, -1, 0]
## nX = 0
## nY = 3

## Example 5
arrInts = [-1, 0, 2, -3, -2, 1]
nX = 0
nY = 2

print (sum(arrInts[nX:nY + 1]))