diff --git a/README.md b/README.md index 3564f70..31b0a41 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ +#Here is where my readme starts +## + +> My method of doing this was with slicing +i took one slice and added to the back of the second slice. +this created the shift needed for the encrytion. + +>to decrypt i uses the key given and subtracted 60 to get back to the coorrect order. +> I created to modules for fun one to encrypt and one tp decrypt. +>ii found this lesseon very informativer and helpfuil + # Caesar Cipher Exercise Code Louisville Python programming exercise. @@ -33,9 +44,7 @@ Note that the program should not replace special characters like spaces or excla ## Instructions -1. GitHub Classroom will send you an email asking you to accept the assignment. -1. Once you've accepted, it will create a repo for you to add your code. -1. Clone your repo, add your code, and Commit/Push your changes to Github. +1. Fork and clone the repo, add your code, and Commit/Push your changes to Github. 1. Mentors will review your submissions and provide feedback. ### Optional: Automated Code Testing diff --git a/cipher.py b/cipher.py index 0e772db..d648664 100644 --- a/cipher.py +++ b/cipher.py @@ -1 +1,16 @@ # add your code here +# my attempt at a caesare cipher: +### +# shift = 15 +choice =input("Type e to encrypt or d to decrypt: ") +if choice == 'e': + import pjs_encryption + pjs_encryption.encryption +elif choice == 'd': + import pjs_decryption + pjs_decryption.decryption +else: + print ("wrong choice") + + + \ No newline at end of file diff --git a/pjs_decryption.py b/pjs_decryption.py new file mode 100644 index 0000000..029e15d --- /dev/null +++ b/pjs_decryption.py @@ -0,0 +1,16 @@ +#decypt + +import string + +def decryption(): + + import string +plain_text = input("what do you want to decrypt? ") +shift1 = int(input("Please enter decrytion key. ")) +shift = 26-shift1 +shift %= 26 +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) +decrypted = plain_text.translate(table) +print(decrypted) \ No newline at end of file diff --git a/pjs_encryption.py b/pjs_encryption.py new file mode 100644 index 0000000..80480e2 --- /dev/null +++ b/pjs_encryption.py @@ -0,0 +1,16 @@ +#my module for encryption + +import string + +def encryption(): + + import string +plain_text = input("what do you want to encrypt? ") +shift = int(input("Please enter encrytion key. ")) +alphabet = string.ascii_lowercase +shifted = alphabet[shift:] + alphabet[:shift] +table = str.maketrans(alphabet, shifted) + +encrypted = plain_text.translate(table) + +print(encrypted) \ No newline at end of file