I would like to do read only the value of the last column Existing Policies through the input of Customer NRIC number. For example, when I input S876XXXXF, the output should give me existing policies: Investments and Travel.
Here is the csv file data:
Customer NRIC,Customer Name,Date of Birth,Existing Policies
S876XXXXF,John Tan,7-Oct-87,Investments and Travel
T019XXXXA,Alice Lim,14-Apr-01,Savings
S921XXXXK,Sam Chua,19-Aug-92,Savings and Investment
Here is what I have coded so far and got stuck:
import csv
filename = "database.csv"
nric = input("Enter your NRIC number: ")
file = open(filename,"r")
with open("database.csv") as customer_info:
csv_pointer = csv.reader(customer_info)
for each in csv_pointer:
print(each[-1])
Thank you!