+ 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?
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?