Skip to content

fixed indexing error#23

Merged
OmkarPathak merged 1 commit into
OmkarPathak:masterfrom
Monsieurvishal:master
Jun 23, 2020
Merged

fixed indexing error#23
OmkarPathak merged 1 commit into
OmkarPathak:masterfrom
Monsieurvishal:master

Conversation

@Monsieurvishal

Copy link
Copy Markdown
Contributor

Enter your message: vishal
Enter you key [1 - 26]: 7
Encrypt or Decrypt? [E/D]: e

IndexError Traceback (most recent call last)
in
35
36 if name == 'main':
---> 37 main()

in main()
30
31 if choice.lower().startswith('e'):
---> 32 print(encrypt(message, key))
33 else:
34 print(decrypt(message, key))

in encrypt(message, key)
9 num = LETTERS.find(chars)
10 num += key
---> 11 encrypted += LETTERS[num]
12
13 return encrypted

IndexError: string index out of range


Above issue was solved

Enter your message: vishal
Enter you key [1 - 26]: 7
Encrypt or Decrypt? [E/D]: e
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-9-9d857a810c45> in <module>
     35 
     36 if __name__ == '__main__':
---> 37     main()

<ipython-input-9-9d857a810c45> in main()
     30 
     31     if choice.lower().startswith('e'):
---> 32         print(encrypt(message, key))
     33     else:
     34         print(decrypt(message, key))

<ipython-input-9-9d857a810c45> in encrypt(message, key)
      9             num = LETTERS.find(chars)
     10             num += key
---> 11             encrypted +=  LETTERS[num]
     12 
     13     return encrypted

IndexError: string index out of range

______________________________________________
Above issue was solved

@OmkarPathak OmkarPathak left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@OmkarPathak OmkarPathak merged commit 1b30337 into OmkarPathak:master Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants