I&C SCI 31 Lecture 5: Lecture 5 notes ICS 31 Winter 2018-1
Document Summary
## ics 31 winter 2018 lecture 5 january 19. You can build new things e. g. , using namedtuple. You can build new actions e. g. , defining functions. What if we want something new, e. g. , double(), so that double(3) is 6. help(len) ## function definition def double (number:int) -> int: # we provide name of the function, #its parameters and what value we want it to return. """docstring comment: one line to describe what it does""" ## statement(s) making up the body of the function. Process called "the design recipe" (see course resources page) Tas and lab tutors will ask if you"ve done it. Lets us break larger problems into smaller ones: modularity. def sum_of_doubles (number1:int, number2:int) -> int: ## to generalize double, triple, quadruple, we can add a parameter multiplier. ## and write a function mult that can multiply by any number def mult (number:int, multiplier:int) -> int: