print ("")
print ("Welcome to Vigenere cipher!")
print ("")
print ("This program will encrypt then offer you a decryption of your message.")
print ("")
print ("Start this off with inputting your message you would like to encrypt.")
m = input("")
print ("")
print ("Now enter your keyword you would like to use. (it must be (" +str(len(m)),"or less letters.))")
k = input("")
if len(k) > len(m):
print ("")
print ("sorry this is an invaild keyword")
print ("Please re-enter your keyword.")
k = input("")
else:
print ("Your keyword is great. Lets keep going")
print ("")
print ("Is this correct?")
print ("")
print("-------\n"
"Message: ",m,"\n"
"Key: ",k,
"\n-------")
print ("")
print ("yes or no")
correct = input ("")
if 'yes'.startswith(correct.lower()):
print("Great! Lets keep going.")
else:
print ("You previously put: " +str(m), " as your message.")
print ("Please re-enter the keyword you wish to use. (it must be (" +str(len(m)),"or less letters.))")
k = input("")
encrypted = ("")
print ("")
for a in m:
print ("The message letters are")
encrypt2 = ord(a)
for b in k:
print ("The keyword letters are")
encrypt = ord(b)
encrypt3 = (encrypt) + (encrypt2)
encrpyted = chr(encrypt3)
print (chr(encrypt3))
我需要它用关键字加密,有什么帮助吗?ps 它需要像上面的代码一样基本。它适用于 GCSE(英国),如果它需要一些命令,那么你能告诉我它们是做什么的吗:) 所以我可以在任务中解释它:)