Encryption 加密赢了';不解密

Encryption 加密赢了';不解密,encryption,Encryption,这里给了我一份加密的学习指南,但你如何解密和阅读它 在一个名为pa11.py的文件中,编写一个名为decode(inputfile,outputfile)的方法。Decode应该采用两个参数——都是字符串。第一个应该是编码文件的名称(helloworld.txt或superdupertopsecretstudyguide.txt或我可能用来测试代码的另一个文件)。第二个应该是将用作输出文件的文件名 您的方法应该读入输入文件的内容,并使用上面的hints.txt文件中描述的方案,解码隐藏消息,在执

这里给了我一份加密的学习指南,但你如何解密和阅读它

在一个名为pa11.py的文件中,编写一个名为decode(inputfile,outputfile)的方法。Decode应该采用两个参数——都是字符串。第一个应该是编码文件的名称(helloworld.txt或superdupertopsecretstudyguide.txt或我可能用来测试代码的另一个文件)。第二个应该是将用作输出文件的文件名

您的方法应该读入输入文件的内容,并使用上面的hints.txt文件中描述的方案,解码隐藏消息,在执行时写入输出文件(或者根据您决定使用的内容一次写入)

一分钱的数学课在这里

“”“
节目名称:pennyMath.py
作者:CS1510
描述:计算字符串的便士数学值。
"""
#获取输入字符串
original=input(“输入一个字符串以获取其成本,单位为penny math:”)
成本=0
检查输入字符串中的每个字符
对于原始字符:
value=ord(char)#ord()给出了编码的数字!
如果char>=“a”和char=“a”以及char=“a”和c=“a”和c 0:
计数=计数-1;
持续
elif c.isalpha():
计数=便士成本(c)
fo.write(c)
elif c.isdigit():
计数=int(c)
fo.write(c)
其他:
计数=6
fo.write(c)
fo.close()
inputfile=input(“请输入输入文件名:”)
outputfile=input(“请输入输出文件名(现有文件将被重写!):”)
解密(输入文件、输出文件)

缺少样本输入。代码中缺少样本输入?问题帖子中缺少样本输入文件。
def pennycost(c):
 
     if c >="a" and c <="z":
        return ord(c)-96
    elif c>="A" and c<="Z":
        return ord(c)-64

  
def decryption(inputfile,outputfile):


    with open(inputfile) as f: 
        fo = open(outputfile,"w") 
        count = 0 
        while True: 
            c = f.read(1)
            if not c:
                break;
            if count > 0: 
                count = count -1;
                continue
            elif c.isalpha(): 
                count = pennycost(c) 
                fo.write(c) 
            elif c.isdigit(): 
                count = int(c) 
                fo.write(c) 
            else:
                count = 6
                fo.write(c)

    fo.close() 

inputfile = input("Please enter the input file name: ")

   outputfile = input("Plese enter the output file name(EXISTING FILE WILL BE OVER WRITTEN!): ")

decryption(inputfile,outputfile)