Sunday, April 19, 2015

Friday, April 17th

Today was a very very short day. We ended school at 11:00, so our class was not even an hour long. We had 40 minutes of class, but I managed to get a lot done.

I finished array 2 ! I only had two problems to do, one that I looked over with Mr. Daly which took us a while to solve, and another which was very similar to the first one.

The problem over which I looked at with Mr. Daly, was one that we already looked at, and thought that we had solved but we actually hadn't. We had the code all correct, but we spent almost 20 minutes simply looking at a code that was missing a bracket. There was one line of code that was supposed to be part of an else if statement, but we were missing the bracket. It was very frustrating, but it taught us the lesson that when we write any sort of if statement or loop, to always put the brackets before anything else so that we can avoid mistakes such as these that can waste your time.

Here was the final problem of Array 2:

----------------------------------------------------------------------------------------------------------------------------------

Return an array that contains the exact same numbers as the given array, but rearranged so that all the even numbers come before all the odd numbers. Other than that, the numbers can be in any order. You may modify and return the given array, or make a new array.

evenOdd({1, 0, 1, 0, 0, 1, 1}) → {0, 0, 0, 1, 1, 1, 1}
evenOdd({3, 3, 2}) → {2, 3, 3}
evenOdd({2, 2, 2}) → {2, 2, 2}




When I told Mr. Daly that I had completed Array 2, he gave me a quick test to write by hand, one of the problems that I did a while back in Array 2. I completed it, and that marked the end of class. 

Next class, String 2 !

No comments:

Post a Comment