Hi Anushka,
And allow me a general remark (to everyone):
Please apply common sense and caution in looking at the provided solutions. These are strictly "sample solutions", not "the solution", i.e., there is generally more than one way to approach each problem (and we'll love to talk about pro's and con's of approaches). Furthermore, the nitpicker in me would even apply caution in using the term "solutions" - these are "solutions" in the sense that they solved the problem of passing the assignment's pass/fail criterion, and might also qualify as solutions in a corporate setting where your customer tells you "please develop a solution that achieves 60% F1 on task ABC". But in an academic sense, these quantitative tasks are hardly ever fully solved, only approached with iteratively better methods, that at some point might saturate (analogy: construction engineers never solve the problem of building bridges, their solutions just get better and better, on varying dimensions (span, cost, construction time, ...).
Cheers,
Simon