Compsci 101, Fall 2014, Classwork Nov 6

Solve these problems and enter them in the google forms for today.

For these problems, see the file parameters.py. For each problem, figure out the output. Think about the scope of the variables.

Put Answer to problem 1 here

Problem 1:

''' example 1''' number = 5 school = 'duke' testone(number,school) print 'After call to testone, number is ', number, ', school is ', school ''' example 2 ''' num = 2 s = 'cat' testone(num,s) print 'After call to testone, num is ', num, ', s is ', s

Put answer to problem 2 here

Problem 2:

'''example 3''' nums = [4,3,8] nums.append(5) testtwo(nums) print 'After call to testtwo, nums is ', nums ''' example 4''' lista = [4,3,8] lista.append(5) testtwo(lista) print 'After call to testtwo, lista is ', lista

Put answer to problem 3 here

Problem 3:

'''example 5''' lista = (4, 5, 2) testthree(lista) print 'after call to testthree, lista is ', lista '''example 6''' lista = [(4, 5, 2),(3,2),(3,4)] testfour(lista) print 'after call to testfour, lista is ', lista '''example 7''' mylist = [(4, 5, 2),(3,2),(3,4)] testfour(mylist) print 'after call to testfour, mylist is ', mylist

Put answer to problem 4 here

Problem 4:

'''example 8''' myset = set([4, 5, 2]) testfive(myset) print 'after call to testfive, myset is ', myset '''example 9''' myset = set([(4,3), (5,2,1), (3,2)]) testsix(myset) print 'after call to testfive, myset is ', myset