I was solving the first code coach in arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I was solving the first code coach in arrays

But the 5th test result had an error msg which i can't see cuz it was locked. So can u guys point out the error here https://code.sololearn.com/c3s1fqJcx8RD/?ref=app

7th Jul 2022, 7:22 AM
Shivansh Mourya
Shivansh Mourya - avatar
2 Answers
+ 3
Your range starts from 0 and finishes at 4 (5 items), so this means that an input of 5 will generate an "Out of Index" error. Adjust your upper condition to >4
7th Jul 2022, 8:07 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Thanks got it
12th Jul 2022, 7:37 AM
Shivansh Mourya
Shivansh Mourya - avatar