有人可以告诉我为什么这段代码不想运行循环似乎有问题,但没有其他问题

问题描述

使用名为的 Python 创建 COVID-19 支持服务应用程序 CovidSupportSystem 将为用户提供以下选项:

• Statistics,• Prevention,• Symptoms,• Treatment and Report case

示例输出如下:

1.1 在统计下说明南澳、中国和美国有多少病例,然后询问 用户是否想查看其他国家/地区的案例,如果是,请询问 他们从 0 到 9 之间选择一个数字,然后从列表中拉出一个国家来显示 用户,示例输出如下:

1.2 在预防下放置一般 COVID19 预防信息,如下所示:

1.3 在症状下方放置一般 COVID19 症状,例如以下内容

1.4。在治疗下放置一般的 COVID19 治疗,例如以下内容

1.5。在报告案例下询问用户是否有任何症状,如果没有,则 声明他们没有 COVID19,如果是,则询问用户他们是否有 温度高于 38.5°C,如果没有,则说明他们没有感染 COVID19,如果 是的,让他们选择哪个国家,美国、南非或中国,在他们完成之后 决定,该国的感染人数应该增加 1 (在问题 1.2 中指出):

1.6。退出选项将关闭程序

def get_menu_choice():
    def print_menu():       # Your menu design here
        print(30 * "-","Welcome to the COVID 19 support service. Please select and option",30 * "-")
        print("1. Statistics ")
        print("2. Prevention ")
        print("3. Symptoms")
        print("4. Treatment ")d
        print("5. Report Case ")
        print("6. Exit ")
        print(73 * "-")

        loop = True
        int_choice = -1

        while loop:
            get_menu_choice()
            choice = input("Enter Choice(1/2/3/4/5/6/)")

            if choice == '1':
                choice = ''
                while len(choice) == 0:
                    print("Statistics""\n"
                          "Currently in SA there are 1,843,572 confirmed cases""\n"
                          "Currently in Usa there are 34,434,803 confirmed cases""\n"
                          "Currently in China there are 91,653 confirmed cases""\n")
                    loop = False
                    while loop:
                        print_menu()
                        choice = input("Would you like to see the statistics of a random country.Y/N")
                    int_choice = 1
                    if choice == 'Y' or 'y':
                        choice = ''
                        while len(choice) == 0:
                            choice = input("To select a country,type a number from 0 to 9 or type 10 to exit")
                        int_choice = y or Y
                        loop = False
                        if choice == '0':
                            choice = ''
                            while len(choice) == 0:
                                print("Australia has 30,380 confirmed cases")
                                int_choice = 0
                            loop = False
                        elif choice == '1':
                            int_choice = -1
                            print("Fiji has 2,270 confirmed cases")
                            loop = False
                        elif choice == '2':
                            int_choice = -1
                            print("India has 30,709 confirmed cases")
                            loop = False
                        elif choice == '3':
                            int_choice = -1
                            print("Brazil has 18,056,639 confirmed cases")
                            loop = False
                        elif choice == '4':
                            int_choice = -1
                            print("SA has 1,572 confirmed cases")
                            loop = False
                        elif choice == '5':
                            int_choice = -1
                            print("UK has 4,651,988 confirmed cases")
                            loop = False
                        elif choice == '6':
                            int_choice = -1
                            print("China has 91,653 confirmed cases")
                            loop = False
                        elif choice == '7':
                            int_choice = -1
                            print("Iran has 3,128,395 confirmed cases")
                            loop = False
                        elif choice == '8':
                            int_choice = -1
                            print("USA has 34,803 confirmed cases")
                            loop = False
                        elif choice == '9':
                            int_choice = -1
                            print("Congo has 12,404 confirmed cases")
                            loop = False
                        elif choice == '10':
                            int_choice = -1
                            print("Exiting")
                            loop = False
                        else:
                            input("Wrong number. Press any key to try again")
                        if End:
                            return [int_choice,choice]

                    elif choice == 'n' or 'N':
                        int_choice = -1
                        print("Exiting")
                        loop = False
                    else:
                        input("Wrong value. Press any key to try again")
                        loop = False
                    if End:
                        return [int_choice,choice]
                        loop = False
                        loop = False
            elif choice == '2':
                choice = ''
                int_choice = -1
                print("Prevention.""\n""\n"
                      "To Prent the spread of COVID 19.""\n"
                      "Clean your hands often. Use soap and water,or an alcohol-based hand rub. At least 70% alcohol."
                      "\n"
                      "Maintain a safe distance from anyone who is coughing or a sneezing.""\n"
                      "Don't touch your eyes,nose or mouth.""\n"
                      "Cover your nose and mouth with your bent elbow or a tissue when you cough or sneeze.""\n"
                      "Stay Home if you feel unwell""\n"
                      "If you have a fever,cough and difficulty breathing,seek medical attention. All in advance.""\n"
                      "Follow the directions of your local health authority.")
                loop = False
            elif choice == '3':
                int_choice = -1
                print("Symptoms""\n""\n"
                      "Most common symptoms:"
                      "Fever"
                      "dry cough"
                      "tiredness""\n"
                      "Less common symptoms"
                      "aches and pains"
                      "sore throat"
                      "diarrhoea"
                      "conjunctivitis"
                      "headache"
                      "loss of taste or smell"
                      "a rash on skin,or discolouration of fingers or toes""\n"
                      "SerIoUs symptoms:"
                      "difficulty breathing or shortness of breath"
                      "chest pain or pressure"
                      "loss of speech or movement")
                loop = False
            elif choice == '4':
                int_choice = -1
                print("Treatment""\n"'\n'
                      "If you feel sick you should rest,drink plenty of fluid,and eat nutritIoUs food. Stay in a "
                      "separate room form other family members,and use a dedicated bathroom if possible. Clean and "
                      "disinfect frequently used surfaces")
                loop = False
            elif choice == '5':
                choice = ''
                while len(choce) == 0:
                    choice = input("Do you have any of the symptoms?y/n")
                while loop:
                    print_menu()
                    choice = input("Do you have any of the symptoms?Y/N")

                int_choice = 5
                loop = False
                if choice == 'y' or 'Y':
                    choice = ''
                    while len(choice) == 0:
                        choice = input("Is your temperature above 38.5C? y/n")
                    int_choice = y or Y
                    loop = False
                    if choice == 'y' or 'Y':
                        choice = ''
                        while len(choice) == 0:
                            choice = input("In which country is the case""\n"
                                           "1.SA""\n"
                                           "2.USA""\n"
                                           "3.China""\n"
                                           "4 Exit""\n"
                                           "enter option(1/2/3/4)")
                        int_choice = y or y
                        loop = False
                        if choice == '1':
                            int_choice = -1
                            print("Currently in SA there are" '1,572 +1' "confirmed cases""\n")
                            loop = False
                        elif choice == '2':
                            int_choice = -1
                            print("Currently in Usa there are" '34,803 + 1' "confirmed cases")
                            loop = False
                        elif choice == '3':
                            int_choice = -1
                            print("Currently in China there are" '91,653 + 1' "confirmed cases")
                            loop = False
                        elif choice == '4':
                            int_choice = -1
                            print("Exiting.....")
                            loop = False
                        else:
                            input("Wrong number. Enter any key to try again")
                        if End:
                            return [int_choice,choice]
                    elif choice == 'N' or 'n':
                        int_choice = -1
                        print("exiting.......")
                        loop = False
                    else:
                        input("Wrong selection. Enter any key to try again")
                    if End:
                        return [int_choice,choice]
                elif choice == 'n' or 'N':
                    int_choice = -1
                    print("Exiting.....")
                    loop = False
                else:
                    input("Wrong selection,Enter any key to try again")
                if End:
                    return [int_choice,choice]
            elif choice == '6':
                int_choice = -1
                print("Exiting....")
                loop = False
            else:
                input("Wrong selection,Enter any key to try again")
                loop = False
            if End:
                return [int_choice,choice]


print(get_menu_choice())

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)