I am trying to read a text file that contains a lot of values. So first I append all the values to my list and my task is to find the sum of these values.
While appending I do something like: lst.append(float(values))
.
I get an error since there are alphabetical strings like DNE
in the values list.
So if value == 'DNE'
how do I ignore that and let the program only focus on float values and add it.
For adding I know it's sum(lst)
, just wanted to know how to ignore that 'DNE'