Skip to content

Commit a4dfcf4

Browse files
authored
Create first_and_last_occurrence.py
1 parent 3e3177d commit a4dfcf4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

first_and_last_occurrence.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
l = [ 1,2,3,4,3,2,6]
2+
3+
print(min([i for i,val in enumerate(l) if val == 2]))
4+
print(max([i for i,val in enumerate(l) if val == 2]))

0 commit comments

Comments
 (0)