Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Caesar Cipher Help
#2
A quick glance shows a mix of 'input()' and 'raw_input'. If you are using Python 2.x use 'raw_input()', if you are using Python 3.x, use 'input()'.

In both cases, the variables will be strings, so you must use them as strings, not numbers. So for example in your 'menu' function, you have the comparison of a 'string' with a number:

if choice==1:    # choice is a string, 1 is an integer
you could resolve this by making your numbers into strings:

if choice=="1":    # Note the quotes around the number 1
Another solution would be to get an integer value rather than a string:

choice = int(input("Enter a number: "))
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
Simple Caesar Cipher Help - by as1221 - Jun-15-2017, 06:48 PM
RE: Simple Caesar Cipher Help - by sparkz_alot - Jun-15-2017, 07:46 PM
RE: Simple Caesar Cipher Help - by as1221 - Jun-15-2017, 08:16 PM
RE: Simple Caesar Cipher Help - by ichabod801 - Jun-15-2017, 09:43 PM
RE: Simple Caesar Cipher Help - by sparkz_alot - Jun-15-2017, 09:51 PM
RE: Simple Caesar Cipher Help - by sparkz_alot - Jun-15-2017, 09:54 PM
RE: Simple Caesar Cipher Help - by ichabod801 - Jun-15-2017, 10:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cesar Cipher ForsakenDusk 5 574 Apr-07-2024, 04:30 PM
Last Post: Pedroski55
Question Rsa Cipher Paragoon2 3 702 Nov-27-2023, 12:30 PM
Last Post: snippsat
  RSA Cipher with blocks Paragoon2 0 545 Nov-26-2023, 04:35 PM
Last Post: Paragoon2
  Caesar Cipher Help pbrowne 2 2,222 Jun-30-2021, 02:36 PM
Last Post: deanhystad
  Learning Python with a Caesar cipher Drone4four 5 4,960 Nov-21-2020, 07:21 PM
Last Post: bowlofred
  Coding caesar's cipher drewbty 3 2,847 May-16-2020, 10:05 AM
Last Post: DPaul
  Can someone please help me convert this simple C ROT cipher code to Python code? boohoo9 5 3,516 Jun-14-2019, 03:02 PM
Last Post: DeaD_EyE
  Caesar Cypher--- I don't understand why it doesn't work ironsheep 12 6,027 Nov-03-2018, 06:53 PM
Last Post: j.crater
  Newbie: Help with code related to Caesar Cipher jessiblah 2 3,442 May-15-2018, 04:28 PM
Last Post: nilamo
  Problem with caesar cipher lucaron 2 2,994 Feb-05-2018, 05:17 PM
Last Post: lucaron

Forum Jump:

User Panel Messages

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