Last active
August 29, 2015 14:03
-
-
Save ShahriyarR/533e72fd857cc79481b0 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
x = [24, 25, 26, 32, 33, 41, 42, 43, 179, 180, 463, 464, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 701, 702, 1332, 1333, 2292, 2293, 2294, 2883, 2884, 3035, 3036, 3037, 3076, 3077, 3208, 3209, 3210, 3519, 3520, 3521, 3839, 3840, 3841, 3842, 3843, 3844, 3997, 3998, 4136, 4137, 4138, 4593, 4594, 4684, 4685, 6442, 6443, 6444, 6445, 6446, 6447, 8110, 8111, 8112, 8113, 8143, 8144, 8272, 8273, 8274, 8578, 8579] | |
t=[] | |
p=True | |
maxPeriod = [] | |
for i in range(0,len(x)-1): | |
# Yoxlayiriq ki, eger reqemlerin ferqi 1-e beraberdirse TRUE qaytarsin. | |
p=(x[i]-x[i-1]==1) | |
if p: | |
# Eger TRUE-dursa, t listine elave edirik. | |
t.append(x[i]) | |
else: | |
# Eger TRUE deyilse o zaman t listini print edirik | |
print t | |
# Uzunlughu burda yoxlayiram | |
if (len(t)>len(maxPeriod)): | |
maxPeriod = t | |
# Hemcinin eger TRUE deyilse t listine yeni qiymeti append edirik. | |
t=[] | |
t.append(x[i]) | |
# en uzunu | |
print "En uzunu (turkunmeseli):" | |
print maxPeriod | |
### NEW Edition ### | |
x = [24, 25, 26, 32, 33, 41, 42, 43, 179, 180, 463, 464, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 701, 702, 1332, 1333, 2292, 2293, 2294, 2883, 2884, 3035, 3036, 3037, 3076, 3077, 3208, 3209, 3210, 3519, 3520, 3521, 3839, 3840, 3841, 3842, 3843, 3844, 3997, 3998, 4136, 4137, 4138, 4593, 4594, 4684, 4685, 6442, 6443, 6444, 6445, 6446, 6447, 8110, 8111, 8112, 8113, 8143, 8144, 8272, 8273, 8274, 8578, 8579] | |
t = [] | |
new_t = [] | |
for i in range(0,len(x)-1): | |
p=(x[i]-x[i-1]==1) | |
if p: | |
t.append(x[i]) | |
else: | |
new_t.append(t) | |
t = [] | |
t.append(x[i]) | |
#print new_t | |
for i in range(len(new_t)): | |
if len(new_t[i]) > 5: | |
print new_t[i] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment