Python Forum
No idea how to use the Caesar Cypher in my code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No idea how to use the Caesar Cypher in my code
#6
The problem is on the last few lines. This will not work:

if passwordToLookup == 'yahoo':
    passwordEncrypt(print(passwords[0][1], encryptionKey))
elif passwordToLookup == 'google':
    passwordEncrypt(print(passwords[1][1], encryptionKey))
When functions are chained like that, they are called and returned from the inside out. So, print() will print the password and key to your console first. Then, print() returns None to passwordEncrypt() because it does not have a return statement. passwordEncrypt() assigns None as the first argument and has no value for the second argument.

To do this, you need this instead:

if passwordToLookup == 'yahoo':
    passwordEncrypt(passwords[0][1], encryptionKey)
elif passwordToLookup == 'google':
    passwordEncrypt(passwords[1][1], encryptionKey)
Reply


Messages In This Thread
RE: No idea how to use the Caesar Cypher in my code - by stullis - Oct-08-2019, 03:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cipher Caesar Azilkhan 1 2,147 Nov-21-2019, 03:40 PM
Last Post: ichabod801
  Caesar cipher Drone4four 19 10,765 Nov-11-2018, 04:07 AM
Last Post: nilamo
  Vigenere and Caesar Cipher sammy2938 1 5,749 Jul-29-2017, 01:32 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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