开发者社区> 问答> 正文

导致语法错误的主要函数?

我的加密/解密程序的泡菜,我的程序有语法错误,我做螺母理解为什么这样做,我设置它喜欢我的租赁项目,这个项目是没有这一点,我想知道为什么它是这样做。


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

展开
收起
kun坤 2019-12-26 14:40:28 366 0
1 条回答
写回答
取消 提交回答
  • 当你定义函数application_flow时,你犯了一个错误,它应该是(),然后:像这样:def application_flow():

    2019-12-26 14:40:36
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多