Can someone help me debug this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone help me debug this code?

https://code.sololearn.com/c8jQPsJggl4j/?ref=app I've been having trouble finding the error for this code after many tries, but I just can't seem to find the error. Can somebody help me out?

7th Mar 2020, 9:32 PM
Ramon Berenguer
Ramon Berenguer - avatar
1 Answer
+ 1
Line 12 parentheses missing. Should be like this: mode = input().lower() Method getKey is wrongly indented. Should be like this: def getKey(): key = 0 while True: print('Enter the key number (1-%s)' % (MAX_KEY_SIZE)) key = int(input()) if (key >= 1 and key <= MAX_KEY_SIZE): return key line 31 to 33 also wrongly indented. Should be like this: if mode[0] == 'd': key = -key translated = '' After that, your code runs, but it will still not do what you want. Can you find the problem?
8th Mar 2020, 12:05 AM
HonFu
HonFu - avatar