0

So i a making a caesar cipher program that uses a keyword. However when i make my program ask for the keyword again for decryption the keywords are apparently treated differently even if i enter the exact same characters.

my first input for a keyword is:

keyword = input("Please enter a keyword")
keyword = keyword.upper()
keyword = keyword.replace(" ","")

my second input is:

keyword2 = input("please enter the keyword again")
keyword2 = keyword2.upper()
keyword2 = keyword2.replace(" ","")

For some reason even if i enter the same characters i get them being counted as different when i test it. This is the only part of my program that changes the keyword variable. The rest of it just grabs the first letter for example.

Al

1 Answers1

0

Hard to say without seeing your input or where you compare them, but I'd guess you're using is where you should use ==. See Why does comparing strings in Python using either '==' or 'is' sometimes produce a different result? for more info.

Community
  • 1
  • 1
Malcolm White
  • 299
  • 2
  • 11