-4

So I have this list:

list1 = [['Car1', 'hyundai', 'blue', 'BF20E1'],['Car2', 'toyota', 'black', 'FD47GH']]

And I have this program:

choice = input('What car you want? ')

And now I want the program to search through the list and find it and print out the details of that certain car. E.g numberplate, colour, type. Does anyone know how to do this? I have been trying with for loops but it doesn't work.

Talha Quddoos
  • 556
  • 6
  • 17
Tigre
  • 296
  • 1
  • 14

1 Answers1

0
for x in list1:
    if(x[0]==choice):
        print(x[1],x[2],x[3]

Hope that this would solve the problem

Talha Quddoos
  • 556
  • 6
  • 17