Python, space in a encryption | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python, space in a encryption

I have a encryption that works but I cannot seem to be able to put a space. Code: A = ‘abcdefghijklmnopqrstuvwxyz’ word = ‘like me’ output = ‘’ for letters in word: index_letter = A.find(letters) output += A[25-index_letter] print(output) When I run the code it says the integer cannot be found or str is not an integer?

16th Apr 2019, 3:01 PM
Ivan
2 Answers
+ 2
Add a space in the string A.
16th Apr 2019, 3:10 PM
Anna
Anna - avatar
- 1
if letters == ' ': output += ' ' Its best to include spaces if ur going to do a ceasar cypher. Here is my implementation. I spread it out some to make it more understandable. I handled spaces by ignoring them: https://code.sololearn.com/cyQGfpp08V0C/?ref=app
23rd Apr 2019, 11:41 AM
Trigger
Trigger - avatar