Mar-27-2018, 01:48 PM
All your points taken into consideration. I'm unsure which direction to go in order to present the user a list of values. I started off with a list but was having trouble presenting the values. With a dictionary, it seems much simpler. I'm a beginner to programming so all the feedback you provided is much appreciated.
I updated my code with the following, per your advice:
I updated my code with the following, per your advice:
databases = { 1: {'name': 'TEST11C'}, 2: {'name': 'TEST12C'}, } # Print databases listed in dictionary print("Databases:") for x, y in databases.items(): print(x, ':', databases[x]['name']) while True: print("\nSelect a database:") d_val = int(input()) if d_val in databases.keys(): d_val = int(d_val) print("\nYou have chosen {0}".format(databases[d_val]['name'])) else: print('\nYou chosen wrong!')