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

started and finished on VCS, then copy-pasted here #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
28 changes: 27 additions & 1 deletion cipher.py
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# add your code here
'''
Project: Caesar Cipher
Jared Joering
Code:You
October 28, 2024

Description: In this exercise we will implement a Caesar cipher with a
right shift of 5. This exercise is based on the Caesar cipher exersise
in the openSAP Python for Beginners course. If you have already solved
it as part of the Learn Python course you can re-use your code here.

Write a Python program that encrypts text given by the user. The program
should ask the user for a plain text sentence and print the encrypted
text. The text should be encrypted using a caesar cipher with a right
shift of 5.
'''

prompt = input("Please enter a sentence: ")
new_sentence = []

for letter in prompt:
if letter.isalpha(): # Checking to see if the letter is alphabetical
new_sentence.append(chr(ord(letter) + 5)) # Moving letter five to the 'right'
else:
new_sentence.append(letter) # Else I'm just appending whatever that current letter is

print("The encrypted sentence is:", ''.join(new_sentence))