CP104 Lecture Notes - Lecture 22: Code Segment

17 views2 pages
School
Course
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Document Summary

A function is a named reusable group of statements that perform a specific task: programming languages typically have a prewritten set of functions that are kept in a library, python v3 has 68 built in functions. Type (used in text in assigned readings) [y/n] : function call (input to bracket = function call) Can be called multiple times in a program. Can be stored in a library and used by other programs: task specific. Code segment is a smaller chunk of code. Easier to code, easier to read, easier to test: enables modular design. Development teams can work on different program segments at the same time writing your own function. Def function_name ([parameter1[, parameter2, ]]): (if no parameters, still need the brackets) o. Statement: statement o, return [value1[, value2, ]] Note: when reading computer notation, the square brackets are used to denote optional items.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents