CMPT 120 Lecture Notes - Lecture 19: Turtle Graphics
meghan78 and 39786 others unlocked
29
CMPT 120 Full Course Notes
Verified Note
29 documents
Document Summary
Lecture 19 part 4: turtle graphics, and functions. Simply executes the statements it contains and then terminates. Executes the statements it contains, and then it returns a value back to the statement that called it. The input, int, and float functions are examples of value-returning functions. Functions are given names (like we give names to variables). Cannot use keywords as a function name. First character must be a letter or underscore. All other characters must be a letter, number or underscore. Function name should be descriptive of the task carried out by the function. Function: specifies what function does. def function_name(): statement statement: function header: first line of function. Includes keyword def and function name, followed by parentheses and colon: block: set of statements that belong together as a group, call a function to execute it. Interpreter jumps to the function and executes statements in the block. Interpreter jumps back to part of program that called the function.