In-Class Questions and Video Solutions

Lecture 4

  1. Function Calls

    How many total lines of output will show up if you run the code below?

    def add(x, y):
    

     0  close
     2  close
     4  check
     5  close
    Check Show Solution

  2. Functions as Arguments

    What does the code below print?

    def sq(func, x):
    

     4  close
     8  close
     16  check
     nothing, it will show an error  close
    Check Show Solution

Course Info

Learning Resource Types

assignment Problem Sets
notes Lecture Notes
theaters Lecture Videos
assignment_turned_in Programming Assignments with Examples