diff options
Diffstat (limited to 'challenge-238/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-238/eric-cheung/python/ch-1.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-238/eric-cheung/python/ch-1.py b/challenge-238/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..940af19099 --- /dev/null +++ b/challenge-238/eric-cheung/python/ch-1.py @@ -0,0 +1,12 @@ +
+## arrInput = [1, 2, 3, 4, 5] ## Example 1
+## arrInput = [1, 1, 1, 1, 1] ## Example 2
+arrInput = [0, -1, 1, 2] ## Example 3
+
+arrOutput = []
+for nLoop in arrInput:
+ ## print (nLoop)
+ arrOutput.append(nLoop if len(arrOutput) == 0 else nLoop + arrOutput[-1])
+ ## print (arrOutput)
+
+print (arrOutput)
|
