~yacinechaouche/+junk/BZR

« back to all changes in this revision

Viewing changes to CODE/FB/IMPYTHONIST/naren.py

  • Committer: yacinechaouche at yahoo
  • Date: 2015-01-14 22:23:03 UTC
  • Revision ID: yacinechaouche@yahoo.com-20150114222303-6gbtqqxii717vyka
Ajout de CODE et PROD. Il faudra ensuite ajouter ce qu'il y avait dan TMP

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
mylo=[int(l) for l in open("num.txt","r").readlines()]
 
2
long_seq,i,temp,max_seq_index=0,0,1,0
 
3
while i<len(mylo):
 
4
    if long_seq>temp: temp,max_seq_index=long_seq,i-1
 
5
    long_seq,j=1,i
 
6
    while j!=len(mylo)-1 and mylo[j]<mylo[j+1] :
 
7
         long_seq+=1
 
8
         j+=1
 
9
    i+=1
 
10
seq = mylo[max_seq_index:max_seq_index+temp]
 
11
print "The longest sequence in File is: %s and sum is %d" % (seq,abs(sum(seq)))