Skip to content
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

PJs_caesar_cipher #2 #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions cipher.py
Original file line number Diff line number Diff line change
@@ -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")



16 changes: 16 additions & 0 deletions pjs_decryption.py
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions pjs_encryption.py
Original file line number Diff line number Diff line change
@@ -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)