Advertisement
TrustierSafe240

ZAD45

May 21st, 2025 (edited)
149
0
177 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | Source Code | 0 0
  1. c=lambda c,s:chr((ord(c)-(b:=65*c.isupper()+97*c.islower())+s%26+26)%26+b)if c.isalpha()else c
  2. def t(p="Odszyfrowac? (T/N): "):
  3.     while(o:=input(p).lower().strip())not in{'t','n'}:print("Prosze wybiez T lub N.")
  4.     return o=='t'
  5.  
  6. print("Zaszyfruj swoja wiadomosc")
  7. s=int(input("Podaj przesunięcie: "))
  8. print(''.join(c(x,s)for x in input()))
  9. print()
  10.  
  11. if t():
  12.     print("\nco chcesz odszyfrowac?")
  13.     print(''.join(c(x,-s)for x in input()))
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement