Skip to content

Commit 3b54aa5

Browse files
authored
Create sum67.py
1 parent 61f04b1 commit 3b54aa5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

List-2/sum67.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def sum67(nums):
2+
n = len(nums)
3+
if n == 0:
4+
return 0
5+
sum = 0
6+
ok = 0
7+
for i in range(n):
8+
if nums[i] == 6:
9+
ok = 1
10+
continue
11+
elif ok == 1 and nums[i] == 7:
12+
ok = 0
13+
continue
14+
elif ok == 1:
15+
continue
16+
sum += nums[i]
17+
return sum

0 commit comments

Comments
 (0)