We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b27a359 commit 48eda6bCopy full SHA for 48eda6b
Section_04/assignment_07.py
@@ -12,20 +12,7 @@
12
13
"""
14
15
-def string_match(a, b):
16
-
17
- # Figure out which string is shorter
18
- shorter = min(len(a), len(b))
19
20
- count = 0
21
22
- for i in range(shorter - 1):
23
- a_sub = a[i: i+2] # gives us substring of size 2
24
- b_sub = b[i: i+2]
25
- if a_sub == b_sub:
26
- count = count + 1
27
28
- return count
+#Your Code Below:
29
30
31
Section_04/assignment_08.py
@@ -14,24 +14,22 @@
-def sum78(nums):
+
- sum = 0
- in_range = False
- for i in range(len(nums)):
- if nums[i] == 7:
- in_range = True
- if in_range == False:
- # sum = sum + nums[i]
- sum += nums[i]
- if nums[i] == 8:
32
33
34
- return sum
35
36
37
print(sum78([1, 2, 2])) #→ 5
0 commit comments