I don't see any tuples in here but still I get the error.
I have tried everything and still doesn't work.
C= 0
C1 = 5
C2 = 4
C3 = 1
original = [[1,C,2,5,2]
[1,C,6,2,7]
[1,C,2,4,7]
[1,C,5,2,2]
[2,C1,3,2,3]
[2,C1,2,8,5]
[2,C1,6,2,6]
[2,C1,6,3,4]
[2,C1,5,2,2]
[3,C2,2,3,6]
[3,C2,2,7,9]
[3,C2,1,6,2]
[4,C3,2,9,4]
[4,C3,0,3,2]]
print(original)
This is the error I get:
Traceback (most recent call last):
File "C:\Users\satish\Desktop\python projects\logic.py", line 6, in <module>
[1,C,6,2,7]
TypeError: list indices must be integers or slices, not tuple
[Finished in 0.2s]
You need to use commas to use a list of lists, you have a wrong syntax:
Try this below:
C = 0
C1 = 5
C2 = 4
C3 = 1
original = [[1, C, 2, 5, 2],
[1, C, 6, 2, 7],
[1, C, 2, 4, 7],
[1, C, 5, 2, 2],
[2, C1, 3, 2, 3],
[2, C1, 2, 8, 5],
[2, C1, 6, 2, 6],
[2, C1, 6, 3, 4],
[2, C1, 5, 2, 2],
[3, C2, 2, 3, 6],
[3, C2, 2, 7, 9],
[3, C2, 1, 6, 2],
[4, C3, 2, 9, 4],
[4, C3, 0, 3, 2]]
print(original)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.