-3

I have some code that keeps saying syntax error please help.

count = 0
output = []
encoded = []
keylist = []
stringlist = []
alphabet = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ]
print(" what would you like to do: ")
print("options: ")
print("1 - encode")
print("2 - decode")
print()
while 1==1:
    option = int(input("option = " ))
    key = input("please enter the key you would like to use: ")
    string = input("please enter the string you would like to encode/decode: ")
    string = string.replace(' ', '')
    keylenth = len(key)
    stringlenth = len(string)
    overlap = stringlenth % keylenth
    leftovers = key[:overlap]
    random = stringlenth-overlap
    random = stringlenth/keylenth
    key = (int(random)*key)+leftovers

    for i in string:
        number = alphabet.index(i.upper())
        stringlist.append(number)

    i = 0

    if(option == 1):
        while count < stringlenth:
            encoded.append((stringlist[i]+keylist[i])%26
            count += 1
            i += 1
        for n in encoded:
            output.appened(alphabet[n])

    string = ''.join(output)
    print()
    print('output::')
    print()
    print(string)
    print()
    print()
MattDMo
  • 100,794
  • 21
  • 241
  • 231
fastwise6
  • 1
  • 1
  • Questions seeking debugging help (**"why isn't this code working?"**) must include the desired behavior, *a specific problem or error* and *the shortest code necessary* to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable Example](http://stackoverflow.com/help/mcve). – MattDMo Apr 11 '16 at 14:31
  • What is exact error message from interpreter? – Nikolai Saiko Apr 11 '16 at 14:34
  • You're missing the closing paren `)` after `%26`. Often when you have a syntax error, you need to look to the previous line or lines. Always, when you post to SO, please try to ask a clear question, giving people all of the relevant information they need. I'm voting to close this question as it's unclear and not well written, and even if it were, it a simply typo. – tom10 Apr 11 '16 at 14:39
  • Welcome to Stack Overflow fastwise6 - please read how to ask a good question - http://stackoverflow.com/help/how-to-ask. This is not a debugging service and you need titles that clearly describe your issue – micstr Apr 11 '16 at 15:12

1 Answers1

0

I see line with missing closing bracket - it may be the reason:

encoded.append((stringlist[i]+keylist[i])%26 )

Nikolai Saiko
  • 1,679
  • 26
  • 27