I am new here (and new to programming). I have tried to locate the relevant questions with no luck.
Basically, I got some lists shown below:
[0, 'a', 1, 3, 3.3, 220, 22.27]
[0, 'b', 1, 13, 3.3, 220, 23.19]
[0, 'c', 1, 23, 3.3, 220, 24.11]
[1, 'a', 1, 3, 3.5, 200, 20.02]
[1, 'b', 1, 43, 3.3, 220, 25.94]
[2, 'a', 1, 3, 3.3, 250, 26.86]
I would like to use list items of indices 1
, 2
and 3
as the comparison key and search within all the lists available with the given key.
If found, then I need it the output to be made up of the list items of indices 0
, 4
, 5
and -1
.
So, with the given lists, the desired procedure is shown below.
First round:
- comparison key :
'a'
,1
,3
- go through the available lists
found the same key in
[0, 'a', 1, 3, 3.3, 220, 22.27]
[1, 'a', 1, 3, 3.5, 200, 20.02]
[2, 'a', 1, 3, 3.3, 250, 26.86]
then create the output
0, 3.3, 220, 22.27
1, 3.5, 200, 20.02
2, 3.3, 250, 26.86
I have no idea how to code this yet, so could anyone help me please?
Thanks in advance