diff options
author | Sudipto Mallick <smlckz@termux-alpine> | 2024-01-13 09:28:10 +0530 |
---|---|---|
committer | Sudipto Mallick <smlckz@termux-alpine> | 2024-01-13 09:28:10 +0530 |
commit | 8fb719f58f91d1f1f187a1db974682fb3736ee05 (patch) | |
tree | 506e070c7900cc5e3fb31000dbd1a39e95809c61 /python/code/3/6.py | |
parent | 53d75846cc95a3af5d90c01b5ef010818b4adcf7 (diff) | |
download | zadania-8fb719f58f91d1f1f187a1db974682fb3736ee05.tar.gz |
Changes to project structure of Python assignments
As was directed to remove assignments.
Diffstat (limited to 'python/code/3/6.py')
-rw-r--r-- | python/code/3/6.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/python/code/3/6.py b/python/code/3/6.py deleted file mode 100644 index 64b1a60..0000000 --- a/python/code/3/6.py +++ /dev/null @@ -1,27 +0,0 @@ -import sys -message = input('Enter message: ') -key = None -try: - key = int(input('Enter key (1-25, -1 - -25): ')) -except ValueError: - print('Invalid key, must be an integer') - sys.exit(1) - -if key < 0: key += 26 -if not (1 <= key <= 25): - print('Invalid key, must be an integer with absolute value between 1 and 25, inclusive') - sys.exit(2) - -marr = bytearray(message, 'ascii') -for i in range(len(marr)): - c = marr[i] - if 64 < c < 64 + 27: - c = ((c - 65) + key) % 26 + 65 - elif 96 < c < 96 + 27: - c = ((c - 97) + key) % 26 + 97 - marr[i] = c - -print('Caesar cipher with k =', key, 'applied to the given message:') -print(str(marr, encoding='ascii')) - - |