>>     < >




In-class notes for 03/10/2014

CS 121B (CS1), Spring 2014

Submitted questions on assignments and technology

  • 10085: led to a fix, thanks! Piazza is safer bet...

  • Example of an error when using recursion (double() problem):

        def double(numlist):
    	if numlist == []:
    	    return 0
    	# assert: there is at least one element in numlist
    	else:  
    	    return 2*numlist[0] + double(numlist[1:])
    

  • Three forms of the + operator:

    • Add numbers, e.g.,     4 + 2.9 --> 6.9

    • Concatenate strings, e.g.,     "hi + "lo" --> "hilo"

    • Concatenate lists, e.g.,     [1, 'a'] + [2] --> [1, 'a', 2]

Upcoming

Submitted questions on readings

  • Note: We will omit "L-system" (we have plenty of other applications that are more important for our purposes -- see Recurring themes)

Summary of strings chapter

Recursion




< >