lec-11-23

lec-11-23 - 1/23 Announcements Last project due THURS Dec...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 11/22/2009 1 ECS 10 11/23 Announcements ¡ Last project due THURS Dec. 3. ¡ Make some progress on it this week. ¡ No lecture Wds! Little review project in lab hours, 11-1 in 2020 SLB. ¡ Today – adding and controlling complexity with functions. Last time ¡ Functions in a module ¡ Function definition ¡ Arguments and parameters ¡ Return values ¡ Functions in a program Functions in Programs ¡ Put function definitions at the top of the file, right after the imports. ¡ Functions must be defined before they can be used! ¡ The code in a function is not run until the function is called. ¡ This is true whether the function is in a separate module or in the file with the program. Example def addOne(x): x = x+1 return x age = 5 next = add_one(age) print "I am",age,"and soon I will be",next Local variables ¡ The variables inside a function are invisible to the main program. ¡ Variables created inside a function are called local variables....
View Full Document

This note was uploaded on 01/14/2010 for the course ECS 10 taught by Professor Amenta during the Spring '07 term at UC Davis.

Page1 / 3

lec-11-23 - 1/23 Announcements Last project due THURS Dec...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online