+ 1

Explaination

Can anyone explain the quetion and program , I didn't get it. The answer is right as it was given by our ma'am. https://code.sololearn.com/c2O8GlUcUPG7/?ref=app

12th Nov 2018, 5:57 PM
Vishal Ghodake
Vishal Ghodake - avatar
2 Respostas
+ 1
As Kishalaya Saha mentioned, your program removes the odd numbers from the list (which happen to be the 0th, 2nd, 4th and 5th element). This is my attempt on fixing your program. https://code.sololearn.com/cuVdAyycb2YS/?ref=app
12th Nov 2018, 9:30 PM
Diego
Diego - avatar
+ 3
It's not doing what the problem asked. It's collecting the odd elements from the original list. x%2!=0 means x is not divisible by 2. In other words, x is odd.
12th Nov 2018, 7:55 PM
Kishalaya Saha
Kishalaya Saha - avatar