0

Calculate middle index code won't run.

Hi. I tried this code in another python ide and it ran fine. Am I going something wrong? print (items[(len(items)//2)-1])

17th Nov 2020, 5:19 PM
Luke Cadwell
Luke Cadwell - avatar
6 Respostas
+ 2
Middle index may not work in plural so you need to put filter
17th Nov 2020, 5:27 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 2
Luke Cadwell it works fine for me. What is the error message you are getting?
17th Nov 2020, 5:30 PM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar
+ 1
That's what I run Items =[1,4,3]; print (items[(len(items)//2)-1])
17th Nov 2020, 6:07 PM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar
+ 1
I tried it in sololearn, here is the link https://code.sololearn.com/c4JqOcd6r2Pe/?ref=app
17th Nov 2020, 6:10 PM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar
0
It just has an X next to test case 1. I don't see how you're supposed to see if it's correct or not with no test case results.
17th Nov 2020, 6:04 PM
Luke Cadwell
Luke Cadwell - avatar
0
Ok, if yours works and mine works then solo learn has a problem.
17th Nov 2020, 6:08 PM
Luke Cadwell
Luke Cadwell - avatar