Tuesday 14 October 2014

CSC165 Lecture Week 5

I had my first ever university midterm this past week and I think I did well. What really surprised me about this midterm was how easy it was for me to understand the questions. I remember that during my first lecture we were given a Python function that read something like this:
def q0 (s1, s2)
               return all ([x not in s2 for x in s1])

It was so confusing at first. I did have some previous programming experience before taking this class, and I just could not understand how you could write a line like this in Python. If I wrote this in Java or Turing like I’ve been taught previously, it would take many more lines.

               Something similar was on the midterm and now, I can just read that as a simple logical statement. If we define S(x) to mean that x is an element of s2, that line of code can be written as:
for all x in s1, not S(x).

It is much easier for me to evaluate this simple logical statement. I am now starting to see why this course is required for computer science.

No comments:

Post a Comment