0
I need to print the first number
11 Answers
+ 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
+ 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] )
+ 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])
+ 2
I didnt understand what you mean
+ 2
Do you want a list of first items?
In your case do you want a get a list like:
[1,2,3]
?
+ 1
Is that possible to store all list is list... Not in tuple
+ 1
I mean this now is in tuple right...
I need only list...
+ 1
So that would be easy for me to work on....
+ 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]]
+ 1
Like this
0
Yes yes