Python Forum
Caesar Cypher--- I don't understand why it doesn't work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Caesar Cypher--- I don't understand why it doesn't work
#9
Thank you for the clarification--- I don't understand why the computer doesn't understand what I meant with cleartext_lowercase(). You understood what I was trying to do, how come computers can't?? What is with the computer and it's thinking??

alphabet= "abcdefghijklmnopqrstuvwxyz"
cleartext= input()
cleartext=cleartext.lower()
def encrypt(cleartext):
    codedtext = " "
    for character in cleartext:
            if character in alphabet:
                newcharacter= (alphabet.find(character) + 13) %26
                codedtext += alphabet[newcharacter]
            else:
                codedtext += character
            return codedtext
print(encrypt(cleartext))
Now when i run the program with sheep as my input, all I get is f---- the other letters are not showing up. f goes with s, but what about heep?? This should be working because I have codedtext+=alphabet[newcharacter].
Reply


Messages In This Thread
RE: Caesar Cypher--- I don't understand why it doesn't work - by ironsheep - Nov-02-2018, 09:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP doesn't work YKR 1 633 Mar-28-2025, 02:10 PM
Last Post: snippsat
  beginner doesn't understand import cimerio 3 489 Feb-12-2025, 05:02 PM
Last Post: cimerio
  I'm trying to install python 3.11.11 on windows 10 - it doesn't work Petonique 2 1,716 Feb-04-2025, 05:42 PM
Last Post: snippsat
  Extending list doesn't work as expected mmhmjanssen 2 1,356 May-09-2024, 05:39 PM
Last Post: Pedroski55
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 1,887 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 3,449 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 1,806 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  client.get_all_tickers() Doesn't work gerald 2 2,561 Jun-16-2022, 07:59 AM
Last Post: gerald
  pip doesn't work after Python upgrade Pavel_47 10 6,679 May-30-2022, 03:31 PM
Last Post: bowlofred
  For Loop Works Fine But Append For Pandas Doesn't Work knight2000 2 2,989 Dec-18-2021, 02:38 AM
Last Post: knight2000

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020