Oct-24-2017, 12:38 PM
(This post was last modified: Oct-24-2017, 12:38 PM by juniorcoder.)
Hi guys,
N=3 (will be 2 at most in the loop I want to create)
T=5 (will start from 2 in the loop I want to create)
I want to print:
x(1)(2),I(1)(1)
x(1)(3),I(1)(2)
x(1)(4),I(1)(3)
x(1)(5),I(1)(4)
x(2)(2),I(2)(1)
x(2)(3),I(2)(2)
x(2)(4),I(2)(3)
x(2)(5),I(2)(4)
I am getting list index out of range error , can you help me or fix it ?
[ for ma in range(1,N):
for a in range(2,T+1):
thevars=[x[ma][a],I[ma][a-1]]
print(thevars)
]
N=3 (will be 2 at most in the loop I want to create)
T=5 (will start from 2 in the loop I want to create)
I want to print:
x(1)(2),I(1)(1)
x(1)(3),I(1)(2)
x(1)(4),I(1)(3)
x(1)(5),I(1)(4)
x(2)(2),I(2)(1)
x(2)(3),I(2)(2)
x(2)(4),I(2)(3)
x(2)(5),I(2)(4)
I am getting list index out of range error , can you help me or fix it ?
[ for ma in range(1,N):
for a in range(2,T+1):
thevars=[x[ma][a],I[ma][a-1]]
print(thevars)
]