SHARE
TWEET

6q Prova de quarta

DomMisterSoja Sep 19th, 2018 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. arquivo=open('vitor.pgm','r')
  2. geral=''
  3.  
  4. l1 = arquivo.readline()
  5. l2 = arquivo.readline()
  6. l3 = arquivo.readline()
  7. for i in arquivo:
  8.     i = i.split(' ')
  9.     print(len(i))
  10.     c=0
  11.     v=[]
  12.     for a in i:
  13.         if c<=(len(i)/2)-1:
  14.             v.append(a)
  15.         c+=1
  16.     v1=v[::-1]
  17.     v2=v+v1
  18.     for a in v2:
  19.         geral += f' {a}'
  20.     geral+=f' \n'
  21. print(geral)
  22.  
  23. arquivo.close()
  24.  
  25. arquivo2 = open('vitor5.pgm','w')
  26. arquivo2.write(l1)
  27. arquivo2.write(l2)
  28. arquivo2.write(l3)
  29.  
  30. arquivo2.writelines(geral)
  31.  
  32. arquivo2.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top