Oct-10-2018, 06:48 AM
I think you want to break out of the loop when the condition is True. But in fact you continue to loop till the end of the file. So at that moment the value of datafile1 is expenses-18 and on line 26 you override the value of datafile that was assigned when the condition was True with the current one (i.e. the last entry in the file).
That said your code has many redundant parts and overall algorythm is far from efficient/best/pythonic one
That said your code has many redundant parts and overall algorythm is far from efficient/best/pythonic one
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs