SHARE
TWEET

Treino para manipulação de arquivo

DomMisterSoja Sep 12th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mat=[[9,2,5],[7,6,3],[1,8,4]]
  2. for i in range(len(mat)):
  3.     print(mat[i])
  4. print()
  5.  
  6. def espelha(n):
  7.     x=[]
  8.     for i in range(len(n)):
  9.         x.append(n[i][::-1])
  10.     for i in range(len(n)):
  11.         print(x[i])
  12.     print('')
  13.  
  14. def inverte(n):
  15.     j = len(n)-1
  16.     x = []
  17.     for i in range(len(n)):
  18.         x.append(n[j][::-1])
  19.         j += -1
  20.     for i in range(3):
  21.         print(x[i])
  22.     print()
  23.  
  24. def complemento(n):
  25.     x=[]
  26.     for i in range(len(n)):
  27.         z=[]
  28.         for y in n[i]:
  29.             j = 10-y
  30.             z.append(j)
  31.         x.append(z)
  32.     for i in range(3):
  33.         print(x[i])
  34.  
  35.  
  36. espelha(mat)
  37. inverte(mat)
  38. complemento(mat)
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