Why doesn't my code work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why doesn't my code work

I tried to make a piece of code that can encode/encrypt a password but it doesn't work. it stops iterating once it gets to capital M. Someone please explain why this doesn't work for me. code is here https://code.sololearn.com/cpQtHrf3T4zL/#py

1st Mar 2020, 8:14 PM
Oreagle
Oreagle - avatar
3 Answers
+ 3
your list named character tuple reached max size. write there print(key) to control and launch program there wont be M but if you try to delete "1" which is first thing then in the output there will be M so use more then 1 lists or two dimensional lists etc
1st Mar 2020, 9:09 PM
meow
meow - avatar
+ 2
It's not clear for me, what you want to achieve with this code. The error that occures says Key error, this means that "M" is not in the dictionary character_keys at the moment you call *print(character_keys["M"])*
1st Mar 2020, 8:40 PM
Lothar
Lothar - avatar
+ 1
I try the code, and seems the "M" isn't in the dictionary...and all key after "M" aren't in the dictionary too. I also try to print len of character_tuple and character_keys, they should be equal, but that is what console diplays: print(len(character_tuple)) #95 print(len(character_keys)) #48
1st Mar 2020, 9:39 PM
Gianni