Monday, October 28, 2013
Week #7: Midterm Review
I got my midterm back. Sadly, but not surprisingly, I didn't do well. I passed but I lost a lot of marks in the first question because I didn't know how to compare tuples. To get the minimum of tuples, you have to compare the first element to find the minimum and if there is more than one that is the same, you compare the second element. By doing it by hand and checking later on Wing, I got the answer. Question 2 I stil didn't get the answer. List comprehensions are hard... It makes sense in my head but the code doesn't want to work :( Last questionn I did okay. I forgot to set the return type as FunctionalList. It was as easy as putting my answer now in FunctionalList(...). Hope I will do better on my next assignments, exercises, and tests.
Monday, October 21, 2013
Week #6
TypeError: 'NoneType' object is not subscriptable
I was getting this error for e4b.py. In the end, I finally understood the recursive function was working by going through my code step by step. Something I learned in programming is a little single thing in your code makes a huge impact. NEVER OVERLOOK ANYTHING. Also it helps a lot to talk about it with someone else because as you're telling them the problem, you figure out the solution suddenly! It's the best feeling when you fix your code and it works. This is more satisfying to me than writing essays. I hope I do well on this exercise.
Tuesday, October 15, 2013
Week #5
Object-Oriented Programming is different from older programming languages because everything is its own object. You can inherit one object's characteristics to another object. Java and C++ are popular object-oriented programming languages. This is useful to programmers because you don't need to write long list of commands and your code is reusable. You can keep referring back to previous code and reduce repetition.
Recursion uses the divide-and-conquer method. It breaks the problem down to smaller problems and doesn't need iteration. This is useful to programmers because when you don't know the size of the output, recursion uses the base case and solves the problem. Some examples using recursion are Koch fractals and Fibonacci numbers. Recursion is a sophisticated way to express complex data structures.
Recursion uses the divide-and-conquer method. It breaks the problem down to smaller problems and doesn't need iteration. This is useful to programmers because when you don't know the size of the output, recursion uses the base case and solves the problem. Some examples using recursion are Koch fractals and Fibonacci numbers. Recursion is a sophisticated way to express complex data structures.
Subscribe to:
Posts (Atom)