'Isn't it possible to use multiple try except statement?

I aim to catch errors so that wrong keywords from the users won't cause a breakdown of the code. Since there are different inputs for specific purposes, I couldn't use just one try/except block. To print the correct data linked to each input, I put the input in the except block, so that when the user types the wrong key, the computer will repeat the same question till the right input is passed in. The error I'm encountering now is: only the first input in the first except block keeps getting printed to the terminal. What can be the possible problem? Thanks as you review the code below.

 data =  data_record = {
        "Age groups": {"teens": teens, "youths": youth, "adult": adult, "oldees": oldees},
        "Gender": {"males": males, "females": females},
        "classified bmi": {"underweight": underweight, "healthy": healthy, "overweight": overweight,
                           "obese": obese}}
    
    population = {"P of oldees per region": {
                                               "p of northeast oldees": p_northeast_oldees,
                                               "p of southeast oldees": p_southeast_oldees,
                                               "p of northwest oldees": p_northwest_oldees,
                                               "p of southwest oldees": p_southwest_oldees,
                                               # "percent ratio of oldees per region": percent_ratio_of_oldees_per_region
                                           }}
    
    data_keys = []
    data_values = []
    population_keys = []
    population_values = []
    for key in data_record.keys():
        data_keys.append(key)
    for key in population_record.keys():
        population_keys.append(key)
    for value in data_record.values():
        data_values.append(value)
    for value in population_record.values():
        population_values.append(value)
    
    data_key_and_values = {key: value for key, value in zip(data_keys, data_values)}
    population_key_and_values = {key: value for key, value in zip(population_keys, population_values)}
    
    print(f'''
    Welcome to Medical Insurance Analysis.
    As an intro, there are two types of information you can further analyze or examine: the data and the population 
    of each data. 
    Please note that any point you see P or p, it stands for population
        ''')
    
    
    def navigation(report=report):
        count = 0
        while count == 0:
            try:
                keys_request = input(
                    'Please type "data" or "population" for you to see the information contained in either '
                    'of the two. ')
                if keys_request.upper() == "DATA":
                    print(f'''
            {", ".join(data_keys)} 
                    ''')
                elif keys_request.lower() == "population":
                    print(f'''
            {", ".join(population_keys)} 
                            ''')
            except ValueError:
                keys_request
            
            try:
                value_request = input(f'''
        Above are the keys to each data.
        Please type the exact case and spelling of any of the keys listed above to get further information: ''')
                for data in data_keys:
                    if value_request == data:
                        print(f'''
        {data_key_and_values[value_request]}
                ''')
                for data in population_keys:
                    if value_request == data:
                        print(f'''
        {population_key_and_values[value_request]}
                ''')
            except ValueError:
                value_request
            
            try:
                analyze = input(f'''
        Do you wish to add some report?, if yes, type the report:
        if no, please type no: ''')
                if analyze.lower() != "no":
                    report += analyze
                    print(report)
                else:
                    print("Good luck as you examine the data")
            except ValueError:
                analyze
            
            try:    
                permission = input("Do you wish to view another dataset? Enter yes or no ")
                while permission.lower() == "yes":
                    navigation()
                count += 1
                if permission.lower() == "no":
                    return '''
        Thanks for reviewing our dataset! Hope to see you around again'''
        
                    break
    
            except ValueError:
                permission


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source