In the first week of lecture, I
had a difficulty to accept the concept of 'not all' and 'not any' and I couldn't
connect the concept of building set and using boolean even though I read the material before the class. Honestly, I didn't understand the lecture right away so I could not write anything on the sheet Professor handed out.
After the lecture, I
reviewed what I learned today and try to understand the
concept step by step. When I just read the note, it wasn't clear to me what these all 'def's mean. So I decided to use examples on python. I wrote the random sets of S1, S2 in python. I tried given 'def's using True and False as elements in a set. After I tried
couple of examples, I could see the big picture and could figure out
what the comments could have been in the lecture. Following is the one example:
def q0(S1, S2):
''' (set, set) -> bool
Return whether ...
'''
return not all({x in S2 for x in S1})
It would return
'True' when all elements in S1 are not
in S2.
In other words, def q0 means:
Some elements of S1 is not an elements of S2.
At first, I was not familiar with expressions, however, after reviewing the material thoroughly it did not feel too complicated. As a result, I could solve the first week tutorial problems without having difficulties.
No comments:
Post a Comment