0

Items inside list

For ex. I have a list of ([[2,1], [2,3], [1,3]]) I want something like dominoes while ([[1,2], [2,3], [3,1]]) I use index.reverse but does't work... How to change the positions of numbers inside list or whatever...

10th Jun 2021, 10:51 AM
Ceno Python
Ceno Python - avatar
4 Respostas
+ 5
Works fine! a=[[2,1],[2,3], [1,3]] a[0].reverse() a[2].reverse() print(a)
10th Jun 2021, 11:16 AM
Abhay
Abhay - avatar
+ 1
Abhay thanks mate. I did't use "()" after reverse 💪💪☘
10th Jun 2021, 11:24 AM
Ceno Python
Ceno Python - avatar
+ 1
Abhay n = 0 for i in range(n,7): print( n, ":" ,i," "*5, 1, ":" ,i," "*5, 2, ":" ,i," "*5, 3, ":" ,i," "*5, 4, ":" ,i," "*5, 5, ":" ,i," "*5, 6, ":" ,i," "*5, ) i +=1 Output it gives is not what I want. 0 : 0 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 0 0 : 1 1 : 1 2 : 1 3 : 1 4 : 1 5 : 1 6 : 1 0 : 2 1 : 2 2 : 2 3 : 2 4 : 2 5 : 2 6 : 2 0 : 3 1 : 3 2 : 3 3 : 3 4 : 3 5 : 3 6 : 3 0 : 4 1 : 4 2 : 4 3 : 4 4 : 4 5 : 4 6 : 4 0 : 5 1 : 5 2 : 5 3 : 5 4 : 5 5 : 5 6 : 5 0 : 6 1 : 6 2 : 6 3 : 6 4 : 6 5 : 6 6 : 6 I want all numbers to start with theirselves until 6(6 included) I want 0:0 until 0:6 Then 1:1 until 1:6 2:2 --> 2:6 3:3 --> 3:6 4:4 --> 4:6 5:5 --> 5:6 and 6:6 Total of 28 couples... dominoes set Where is my mistake??
10th Jun 2021, 1:08 PM
Ceno Python
Ceno Python - avatar
0
Arsen Lufo you should open a new question for this problem as it has nothing to do with original question . But i will try to look into it later on .
10th Jun 2021, 1:37 PM
Abhay
Abhay - avatar