[Tutor] problem solving with lists
Dennis Lee Bieber
wlfraed at ix.netcom.com
Fri Mar 18 11:36:39 EDT 2022
On Fri, 18 Mar 2022 16:12:19 +0100, <marcus.luetolf at bluewin.ch> declaimed
the following:
>…many thanks for your quick replay.
>
>When I used a for loop :
>
>
>
>>lst = [['a', 'b', 'c'], ['d', 'e', 'f'], ['a', 'b', 'g'], ['b', 'c', 'h']]
>
>>sub_lst = []
>
>>for p in lst:
>
>> pair1 = lst[p][0:2]
"p" IS the "sublist", not an index.
pair1 = p[0:2]
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Tutor
mailing list