From 45911b26ed0a5dbc5451e26b2b56da027bdc20a2 Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:22:30 +0000 Subject: [PATCH 1/5] GitHub Classroom Autograding Workflow --- .github/workflows/classroom.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/classroom.yml diff --git a/.github/workflows/classroom.yml b/.github/workflows/classroom.yml new file mode 100644 index 0000000..81a4cb0 --- /dev/null +++ b/.github/workflows/classroom.yml @@ -0,0 +1,30 @@ +name: Autograding Tests +'on': +- workflow_dispatch +- repository_dispatch +permissions: + checks: write + actions: read + contents: read +jobs: + run-autograding-tests: + runs-on: ubuntu-latest + if: github.actor != 'github-classroom[bot]' + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: caesar test + id: caesar-test + uses: classroom-resources/autograding-command-grader@v1 + with: + test-name: caesar test + setup-command: pip install pytest + command: pytest tests.py + timeout: 10 + max-score: 100 + - name: Autograding Reporter + uses: classroom-resources/autograding-grading-reporter@v1 + env: + CAESAR-TEST_RESULTS: "${{steps.caesar-test.outputs.result}}" + with: + runners: caesar-test From 8c1c9eae065723506057b7a4be459c81d8503e9b Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:22:31 +0000 Subject: [PATCH 2/5] GitHub Classroom Feedback --- .github/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/.keep diff --git a/.github/.keep b/.github/.keep new file mode 100644 index 0000000..e69de29 From b79af82c77e36ffbc3ac62e74daed0e53add49ab Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:22:32 +0000 Subject: [PATCH 3/5] Setting up GitHub Classroom Feedback From 7b96200b7f174dbf4e1616316e2ddec29367e4b0 Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:22:35 +0000 Subject: [PATCH 4/5] add online IDE url --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3564f70..404fd0c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-2e0aaae1b6195c2367325f4f02e2d04e9abb55f0b24a779b69b11b9e10269abc.svg)](https://classroom.github.com/online_ide?assignment_repo_id=15451420&assignment_repo_type=AssignmentRepo) # Caesar Cipher Exercise Code Louisville Python programming exercise. From a2c208e373c398e73bed2bb4bb7f575e2f016c2a Mon Sep 17 00:00:00 2001 From: vitiale Date: Wed, 24 Jul 2024 00:50:00 -0400 Subject: [PATCH 5/5] Version 1.0 --- cipher.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cipher.py b/cipher.py index 0e772db..b044116 100644 --- a/cipher.py +++ b/cipher.py @@ -1 +1,21 @@ # add your code here +from itertools import cycle +alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] + +def matchingLetter(letter): + if letter in alphabet : + longitud = alphabet.index(letter)+5 + if longitud > 25: + letter = alphabet[longitud - 26] + else: + letter = alphabet[alphabet.index(letter)+5] + return letter + + +user_text = input('Please enter a senctence: ') +user_text = user_text.lower() + +resp = "" +for let in user_text: + resp = resp + matchingLetter(let) +print('The encrypted sentence is:', resp)