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?
2 ответов
+ 2
Add a space in the string A.
- 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