Skip to content

Move files to separate directories #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions Caesar Cipher.py

This file was deleted.

43 changes: 43 additions & 0 deletions ciphers/Caesar Cipher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# The Caesar Cipher Algorithm

def main():
message = input("Enter message: ")
key = int(input("Key [1-26]: "))
mode = input("Encrypt or Decrypt [e/d]: ")

if mode.lower().startswith('e'):
mode = "encrypt"
elif mode.lower().startswith('d'):
mode = "decrypt"

LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

translated = ""

message = message.upper()

for symbol in message:
if symbol in LETTERS:
num = LETTERS.find(symbol)
if mode == "encrypt":
num = num + key
elif mode == "decrypt":
num = num - key

if num >= len(LETTERS):
num = num - len(LETTERS)
elif num < 0:
num = num + len(LETTERS)

translated = translated + LETTERS[num]
else:
translated = translated + symbol

if mode == "encrypt":
print("Encryption:", translated)
elif mode == "decrypt":
print("Decryption:", translated)


if __name__ == '__main__':
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.