2023-02-07 14:54:30 +01:00
|
|
|
#!/usr/bin/env python3
|
2022-05-16 20:32:58 +02:00
|
|
|
|
2022-05-22 18:07:02 +02:00
|
|
|
from string import ascii_lowercase as lc, ascii_uppercase as uc
|
2022-05-15 15:04:38 +02:00
|
|
|
from sys import argv
|
|
|
|
|
2022-05-22 18:07:02 +02:00
|
|
|
def rot(m: str, n: int):
|
|
|
|
return m.translate(m.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n]))
|
2022-05-16 20:32:58 +02:00
|
|
|
|
2022-05-15 15:04:38 +02:00
|
|
|
if __name__ == "__main__":
|
2022-05-16 20:32:58 +02:00
|
|
|
try:
|
|
|
|
a=argv[1]
|
|
|
|
b=int(argv[2])
|
|
|
|
except IndexError:
|
|
|
|
a=input("Give text to encode/decode: ")
|
|
|
|
b=int(input("Type how many shifts do you want to do: "))
|
2022-05-22 18:07:02 +02:00
|
|
|
print(f"Text: {rot(a, b)}")
|