Created
April 9, 2017 02:07
-
-
Save wrmedford/d35259774198ca6d125ef18c745f7ba5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def count_code(l): | |
| x=l.split() | |
| count = 0 | |
| c = False | |
| o = False | |
| r = 0 | |
| for i in range(len(x)): | |
| if str(x[i]) == "c": | |
| c = True | |
| r = i | |
| elif c == True: | |
| if str(x[i]) == "o" & r -1 == i: | |
| o = True | |
| r = i | |
| elif i - 2 == r & str(x[i]) == "e": | |
| if c == True & "o" == True: | |
| c = False | |
| o = False | |
| count +=1 | |
| elif i - 1 == r & c == True & o == True: | |
| pass | |
| else: | |
| c = False | |
| o = False | |
| return count | |
| count_code("code") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment