Topics: More Functions as Objects, Keyword Arguments, Default Arguments, Debugging: glass box/black box testing, examples
Lecture Notes
Lecture 12: List Comprehension, Functions as Objects, Testing, Debugging
Readings
Ch 4.4, Ch 8
Finger Exercise Lecture 12
Implement the function that meets the specifications below:
def count_sqrts(nums_list):
"""
nums_list: a list
Assumes that nums_list only contains positive numbers and that there are no duplicates.
Returns how many elements in nums_list are exact squares of elements in the same list, including itself.
"""
# Your code here
# Examples:
print(count_sqrts([3,4,2,1,9,25])) # prints 3
6.100L Finger Exercises Lecture 12 Solutions
Problem Set 3
Recitation 6
Recitations were smaller sections that went over the previous lectures. Files contain recitation notes and worked examples in code.