I'm print what's on a CSV file by searching it up but if I enter a different name that's not on the CSV file it will just stop running for some reason. For example in the input when I enter (hello) which is not in the CSV file, it will just stop like end the program. I need help with fixing that I tried else statement but it didn't work. I have provided the pic of the CSV file below.
def booking_court()
location = (console.input("[bold bright_yellow]Please Enter the Name of the Chosen Gym:[/] ").lower().title())
with open("location2.csv") as csvfile:
csvreader = csv.reader(csvfile, delimiter=',')
for idx, row in enumerate(csvreader):
if idx == 0:
titles = row
elif location in row[0]:
for key, value in zip(titles, row):
console.print("[bold yellow]%s: [/][bold blue]%s[/]" % (key, value))
console.print("**********************************************************************")