Exercise 1-3
Exercise 4
Reflection
At first I thought there was more than one floating number in each line of mbox-short.txt starting with ‘X-DSPAM-Confidence:’. So I wrongly used the for loop and isintance() function. After I found the total variable would remain 0 and the line with isinstance() is correct, I printed items in the for loop and realized for loop should not be used there as it would give me individual characters and digits. Then I printed the line in the file and then converted it into a list with two components. The print is always helpful.
Practice can help me find out that I am not really get some of the concepts. When I was working on the game app I realized that there were some unclear points in the previous chapters, I reread chapter 8 again and found the traversing part and converting between strings and lists very helpful.
The 4th exercise with introduction of list of lists can be very helpful when doing data analysis as it is a good way to form a table or a data structure. Although at first it is difficult to get what I want, it is a quite good exercise and I learned much from it.