We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 917069b commit 2d48e44Copy full SHA for 2d48e44
python/list-2/has22.py
@@ -3,4 +3,12 @@
3
"""
4
5
def has22(nums):
6
-
+ is_2 = False
7
+ for i in nums:
8
+ if is_2:
9
+ if i == 2:
10
+ return True
11
12
+ elif i == 2:
13
+ is_2 = True
14
+ return False
python/list-2/sum13.py
@@ -5,8 +5,9 @@
def sum13(nums):
- idx_after = 0
- for idx, i in enumerate(nums):
- if i == 13:
- i = 0
- idx_after = idx + 1
+ total = 0
+ for i in range(len(nums)):
+ if nums[i] != 13:
+ if i == 0 or nums[i-1] != 13:
+ total += nums[i]
+ return total
python/list-2/sum67.py
@@ -5,4 +5,15 @@
def sum67(nums):
+ is_6 = False
+
+ if i == 6:
+ is_6 = True
+ elif not is_6:
15
+ total += i
16
+ elif i == 7:
17
18
19
0 commit comments