Advertisement
DomMisterSoja

4q Prova de quarta

Sep 19th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. l=''
  2. print('1-Para inserir a frase a ser criptografada\n2-Discriptografar a frase')
  3. escolha=int(input())
  4. if escolha==1:
  5.     arquivo = open('crip.txt', 'w')
  6.     a = input('Insira a palavra a ser criptografada')
  7.     for i in a:
  8.         b=ord(i)
  9.         b=b+3
  10.         c=chr(b)
  11.         l+=f'{c}'
  12.     arquivo.writelines(l)
  13.     arquivo.close()
  14.     print(l)
  15. if escolha==2:
  16.     arquivo=open('crip.txt','r')
  17.     for i in arquivo:
  18.         for a in i:
  19.             b=ord(a)
  20.             b=b-3
  21.             c=chr(b)
  22.             l+=f'{c}'
  23.  
  24.     print(l)
  25.     arquivo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement