为什么我在这个print语句中获得了无效的语法?

时间:2018-05-23 20:56:13

标签: python-3.x

为什么我在第28行遇到语法错误?看起来它应该只是打印语句的正常代码行,但我不断收到正常的语法错误。

"version": "2.0.0"

此后的行

print('Welcome to the encryptor program.')
message = input('Enter the message you would like to encrypt.\n')
message = message.lower()
key = input('Enter the key you would like to use.\n')
def encrypt(k, m):
    count = 0
    keyCount = 0
    fullCount = 0
    newM = ''
    while fullCount < len(m):
        if (count) >= len(str(key)):
            keyCount = 0
            num = ord(m[count]) - 97
            if m[count] != ' ':
            add = int((str(k))[keyCount])
            newNum = (num + add) % 26 + 97
            new = chr(newNum)
            newM += new
        else:
            newM += ' '
        count += 1
        fullCount += 1
        keyCount += 1
    print(newM)
encrypt(key, message)
def new_key(k):
    newKey = int('1' + '0' * (((len(str(k))))-1) - key

0 个答案:

没有答案