When going over the lecture slides, I was confused for a while with the word 'any' in the following function:
def q1(S1, S2):
''' (set, set) -> bool
Return whether ...
'''
return any ({x in S2 for x in S1})
'Any' could mean that within a given set, any element will return true for a certain statement (basically meaning all of them will return true), or it could mean whether there are any elements in the given set that will return true for the statement (if there exists one or more elements that will return true for the statement). In the end, I tested the function out in Python shell and learned that it had the latter meaning.
Overall, I'm finding CSC165 to be quite enjoyable. Content is a little too simple at the moment, but I'm sure it gets more challenging later on.
No comments:
Post a Comment