Skip to content

Commit d8c4d9f

Browse files
authored
Update assignment_05.py
1 parent 2e2e0b8 commit d8c4d9f

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

Section_04/assignment_05.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,14 @@
1010
first3([1, 2, 6, 3, 4]) → True
1111
first3([1, 2, 3, 4, 6]) → False
1212
first3([1, 2, 3, 4, 5]) → False
13-
1413
"""
15-
16-
def first3(numbers):
17-
18-
end = len(numbers)
19-
20-
if end > 4:
21-
end = 4
22-
23-
for i in range(end): # loop over index 0,1,2,3
24-
if numbers[i] == 6:
14+
def find_num(list):
15+
for i in range(0,4):
16+
if list[i]==6:
2517
return True
26-
27-
# if we get here, the loop is over and we didn't find a 6
2818
return False
2919

20+
3021

3122
print(first3([1,2,6,3,0,0])) # true
3223
print(first3([1,2,3,3,0,6])) # false

0 commit comments

Comments
 (0)