【发布时间】:2019-09-02 10:33:19
【问题描述】:
我必须在上面的程序中定义函数vigenere来实现但是错误
TypeError: -: 'str' 和 'int' 的操作数类型不受支持
#checking for upper case and lower case by applying formula for chr and ord and implementing function vigenere
def vigenere(c, k):
if c.isupper():
return chr(((ord(c)-65 +ord(k) for x in k-65)%26)+65)
else:
return chr(((ord(c)-97 +ord(k) for x in k-97)%26)+97)
【问题讨论】:
标签: python python-3.x