In this week, working on computer science becomes more and more interesting. Our lectures, exercises and labs all improve my programming skills and let me understand well.
First of all, I want to talk about my exercise2 which help me to practice using the ‘Exception’. In my opinion, ‘Exception’ is that we can except when something happens, the function will raise a error to help you figure out what kind of error your function makes. In the exercise2, I fixed a mistake for long time. I raise a ValueError when x cannot be convert to a integer with int(x) if x is a str. But actually we do not need to raise that because python can raise that error itself. Therefore, next time, I really need to read the handout carefully. And the next thing is the order of our exceptions. Before the exercise, I think the order of the if loop cannot influence the result. However, I fail a test in my e2b but my function has only one difference with others who pass the test. I did not find my error, but my partner helped me find that. He tested if the order can influence the result, and it worded. Therefore, I fixed this problem. I also think that let other people help you figure out your mistake is a good choice. Because sometimes people cannot see the error in their own works.
Secondly, for my lab, it really goes on well. This is the first time I try to use unittest to test our function by ourselves. I and my partner at first thought our works are perfect. After testing it, we caught many error in it. Hence it is very important for us to learn to test by ourselves before someone else help you to find the mistakes.