Please Tell me what's going wrong in my codes , it's showing "d[j 1]=int(n) Index Error: list assignment index out of range"...see that line 13
CodePudding user response:
d
only has one value, which is 10
. You are trying to take the index 0 1
, i.e. the second element in d
, even though this second element doesn't exist.
Perhaps d.append(j)
is what you're looking for?
CodePudding user response:
If I understood correctly what you want, it would have to be like this:
b=3
print(b)
d=[0]
a=[5]
i=0
j=0
c=0
while(c<d[0]):
print("Enter Values: ")
m,n=(input(" ").split(','))
d[j]=int(m)
m=0
d[j 1]=int(n)
n=0
a[i]=d[j] d[j 1]
a[i 1]
print("Answer: " str(a))
Result:
3
Answer: [5]
Since c and d are equal to 0, while passes through and prints the a