I am writing a simple car rental system to check price of a car.

This is the `Available Vehicles.txt` In which the 3rd row is the car price.

```
RegNumber | Car Name | Price | Transmission Type

```

```
H4E-11,Toyota,66,Automatic Transmission
X11-11,Volkswagen,62,Automatic Transmission
JBA-123,Ibiza,65,Automatic Transmission
MDZ-A1A,Kodiaq,71,Automatic Transmission

```

I want to loop through the first row and if the registration number matches the entered registration number it goes through the line and checks the price in the third column

I have a function that asks user to enter his/her car registration number it then checks if the registration number is available in the first row of a file.

```py
def returnCar():
    # Ask registration number of car to rent
        regNumber = str(input("Please enter Registration Number of Car: "))

 # Check if Car is  in the system

        regNumbers = []  # List of registration number [H4E-11, X11-11, JBA-123, MDZ-A1A]

        with open("../AvailableVehicles.txt", "r", encoding="utf-8") as f:
                for data in f:
                        regRow = str(data.split(",")[0])
                        regNumbers += [regRow]   # append registration number to the list
        if regNumber in regNumbers:
                # get price from equivalent row

```

I want to print something like:

```
Please enter Registration Number of Car: H4E-11
The price is: 66 dollars

```