Exclude zero list elements in Python
Advertisements I have a list km2. I am performing a list operation and generating a new list Time. However, I am getting an error because of the 0 element. I present the expected output. km2=[0, 2.8945617583603203e-05, 0, 2.8964584076162397e-05, 2.8807838358146397e-05, 2.884599889020239e-05, 2.8869540930559196e-05] Time=[-1/i for i in km2] print(Time) The error is in <listcomp> Time=[-1/i for i… Read More Exclude zero list elements in Python