Berkeley 61a HW2


So I finished HW1 today, and I decide finish the HW2 today also, because they are all basement questions what ever python or other language, even though algorithm either.

And now, Let’s see the first question :

H2Q1

Here is my ansering coding below:

And there is the offical code:

It’s same with mine.

Let’s start the No.2 question:

My code:

And my code is same with the official code:

And now, let’s start qustion 3:

And I got some mistake in English that I can’t really understand what the question say at first, and I make some trouble in programming, fortunatelly I finished it in the end, I use 61 minutes on this question, haha.

Here’s my code and official code below:

Finally, I have just 1 question today! Just do it:

I can’t do it myself, so I read the solution and now I know how to design this, here is the office code:

And the Q4-2 I even can’t do it, too.

But in the end, I do the Q4-3 by myself, here is my code and official code below:

I finally finish HW2….

It’s so tired…

I will be a brave student tomorro, good night.