9th Aug 2023, 11:48 AM
Thile Dorje Lama
Thile Dorje Lama - avatar
11 odpowiedzi
+ 6
This example will help you to manage tuple data items. To play with it and change the index numbers help to see what happend. https://code.sololearn.com/cg85AA04bN4z/?ref=app
9th Aug 2023, 1:33 PM
JaScript
JaScript - avatar
+ 4
Is very simple.. Instead that print it, append an item to an empty list. Ex: r=[] for t in l: r.append( t[0] )
9th Aug 2023, 12:17 PM
KrOW
KrOW - avatar
+ 2
because you managing a list of tuples that contains the number as first item you have to loop on every tuple (list items) and print the first item of them...Assuming the original list is names as l for tup in l: print(tup[0])
9th Aug 2023, 11:57 AM
KrOW
KrOW - avatar
+ 2
I didnt understand what you mean
9th Aug 2023, 12:09 PM
KrOW
KrOW - avatar
+ 2
Do you want a list of first items? In your case do you want a get a list like: [1,2,3] ?
9th Aug 2023, 12:14 PM
KrOW
KrOW - avatar
+ 1
Is that possible to store all list is list... Not in tuple
9th Aug 2023, 12:08 PM
Thile Dorje Lama
Thile Dorje Lama - avatar
+ 1
I mean this now is in tuple right... I need only list...
9th Aug 2023, 12:10 PM
Thile Dorje Lama
Thile Dorje Lama - avatar
+ 1
So that would be easy for me to work on....
9th Aug 2023, 12:12 PM
Thile Dorje Lama
Thile Dorje Lama - avatar
+ 1
[[1], [6, 18, 19, 0, 39, 671], [19, 1, 41, 3, 57], [19, 37, 22, 3, 17, 36], [11, 39, 4, 1, 7, 36], [8, 14, 24, 10, 4, 32], [1]], [[2], [0, 13, 15, 2, 12, 228], [19, 6, 15, 1, 23], [20, 40, 59, 5, 10, 479], [12, 47, 15, 0, 33, 479], [8, 15, 22, 23, 1, 47], [3]], [[3], [1, 7, 30, 4, 3, 593], [19, 10, 48, 4, 56], [21, 45, 18, 0, 52, 114], [13, 56, 6, 5, 41, 114], [8, 16, 20, 35, 4, 62], [5]]
9th Aug 2023, 12:17 PM
Thile Dorje Lama
Thile Dorje Lama - avatar
+ 1
Like this
9th Aug 2023, 12:17 PM
Thile Dorje Lama
Thile Dorje Lama - avatar
0
Yes yes
9th Aug 2023, 12:14 PM
Thile Dorje Lama
Thile Dorje Lama - avatar