Need help in my code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
7th Apr 2020, 5:30 PM
John Rocel Perez
3 Answers
+ 3
Highest possible index is 4. m=4 is value in last loop. m+1 crashes line 33 -36 should be executed only if m<4
7th Apr 2020, 5:44 PM
Oma Falk
Oma Falk - avatar
+ 3
while m<5: ... should probably be: while m<4: ... but I doesn't know the purpose of your calculation ;) The problem is that you increment (add 1) to m at each iteration of the loop. So, when you reach the last iteration, m==4, and m+1==5 wich is out of range index of a 5 items list ^^
7th Apr 2020, 5:48 PM
visph
visph - avatar
0
Oww. Thank you! I appreciate you answer. It's ok now. Self studying of programming ain't easy but with people like you it's not impossible. God bless you both btw i'm trying to create a simple electric circuit solver.
7th Apr 2020, 5:51 PM
John Rocel Perez