Oh and the txt file we're pulling from has a bunch of "X-DSPAM-Confidence: 0.#####" lines that we're referring from along with other random text lines.
I'm back with more Python hmwk ;_;
I feel like I have some of the right pieces, but it's scattered and in the wrong order. I know that some pieces are incorrect (lines 6-10) or duplicated because I copied over some code from a previous assignment I did that had some lines I needed, but with different outputs. I need help in organizing these functions in order to reflect the assignment instructions. I always seem to get pieces of it, but mess up with putting things together correctly. Thanks in advance to any input you guys give and also thanks for your patience with my slow comprehension of Python <3
(you need an account to see links)
Oh and the txt file we're pulling from has a bunch of "X-DSPAM-Confidence: 0.#####" lines that we're referring from along with other random text lines.
Okay so a few pointers to give you some food for thought.
1) Sounds like you need to extract each of the floating point numbers referred to in ## in each line of the source file being read in that matches this format "X-DSPAM-Confidence: #.#####"
2) So, during the loop when it finds that match type, then the program should keep track of the total addition of those numbers found to date
3) After the loop that total number should be divided by the number of times those lines were found, which would give you the average across all the numbers found that match that format
4) Keep in mind how Python does blocks, is your FOR loop working correctly the way it is? Why is there a total=0 on line 11, isn't that going to reset the value of total after the loop? Don't you want to add the value to the "total" inside the loop? Also why is count=0 in line 12 that is just going to reset the count on the loop too.
Have a think of it and report back with what you tried out
linttastic(06-27-2020),Zachafer (06-29-2020)
Hey thanks for breaking it down for me! I got it set up properly after I looked over the FOR loop. Later, it turned out I had my float set up wrong that it ended up returning a nan error. Well all done now anyway, phew! Thanks again for helping! I appreciate having someone else just sort of re-read it for me so I can make sure I understand the assignment at least haha.
aaronsd (06-27-2020)