I am trying to find a way to associate an unknown value with the data it's supposed to be associated with it. Example: account number with the relevant information and then extract the specific value I need to use from the list of information available for this specific account.
What I have tried:
matrix_accounts = [["1", "Kamal Mohsen", 13000],
["2", "Sherif Lasheen", 340],
["3", "Karma Mourad", 60000],
["4", "Nermeen Hossam", 20],
["5", "Fady Gamal", 9000]]
account_number_required = int(input("Hello, please insert account number"))
matrix_length = len(matrix_accounts)
for i in range(matrix_length):
if account_number_required == matrix_accounts[i][0]:
break
print("Hello", matrix_accounts[i])
What I would like to get, is for the code to loop through the matrix's first row to check if the input exists in the matrix. And then to recognise the row in which the value it has found is situated and then print the whole row or a specific value that I need from that row.