我的加密/解密程序的泡菜,我的程序有语法错误,我做螺母理解为什么这样做,我设置它喜欢我的租赁项目,这个项目是没有这一点,我想知道为什么它是这样做。
def table():
decrypted = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890 "
encrypted = b"NEVI3C0P8MY1HW6S9AU2OJl7D5GXRK4BZF.QT "
encrypt_table = bytes.maketrans(decrypted, encrypted)
decrypt_table = bytes.maketrans(encrypted, decrypted)
result = ''
choice = ''
message = ''
return choice
def application_flow():
print(" ______________________________________________")
print("| The Unhackable Simulator |")
print(" ----------------------------------------------")
print("Disclaimer: This can be very easy to hack!")
while choice != '0':
choice = input("\n Do you want to encrypt or decrypt a message?\n E to encrypt, D to decrypt or X to exit the simulator: ")
if choice == 'E':
message = input('\nEnter message for encryption: ')
result = message.translate(encrypt_table)
print(result + '\n\n')
print("Success on your encyrpted sentence!")
print('\n\n')
elif choice == 'e':
message = input('\nEnter message for encryption: ')
result = message.translate(encrypt_table)
print(result + '\n\n')
print("Success on your encyrpted sentence!")
print('\n\n')
elif choice == 'D':
message = input('\nEnter the secret code!: ')
result = message.translate(decrypt_table)
print(result + '\n\n')
print("You have decoded a secret!")
print('\n\n')
elif choice == 'd':
message = input('\nEnter the secret code!: ')
result = message.translate(decrypt_table)
print(result + '\n\n')
print("You have decoded a secret!")
print('\n\n')
elif choice == 'X':
print("")
print(" ________________________________")
print("| Be safe while surfing the web! |")
print(" --------------------------------")
elif choice == 'x':
print("")
print(" ________________________________")
print("| Be safe while surfing the web! |")
print(" --------------------------------")
break
while choice != '0':
print("")
print('Uh oh! An error occured, please try again my young padawan! \n\n')
application_flow()
application_flow()
错误代码:def application_flow:()冒号处的语法无效(完成) 错误代码:返回函数在函数外第20行(完成) 错误代码:
break
while choice != '0':
print("")
print('Uh oh! An error occured, please try again my young padawan! \n\n')
application_flow()
中断和while选择之间的错误,表示中断在循环之外,而while选择 问题来源StackOverflow 地址:/questions/59384324/main-functions-causing-syntax-errors
当你定义函数application_flow时,你犯了一个错误,它应该是(),然后:像这样:def application_flow():
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。