Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

91 bytes added, 08:01, 31 May 2017
INVESTIGATION 1: USING FUNCTIONS
= INVESTIGATION 1: USING FUNCTIONS =
:A very simple definition of using '''functions''' is to create and reuse '''smaller programs within a larger program'''. In programming languages such as '''C''', '''C++, ''' and '''Java''', commonly used functions (programs) that are very useful are collected pre-packaged in various '''Libraries''' and thus . This relates to dependency issues that were discussed when compiling C programming code in your OPS25 course: if a supporting library is missing, the program would be able to run the called function. We do not go into detail involving Libraries for this course since Python is an '''interpreted ''' (i.e. not a compiled) language.
:Usually, a '''function''' will '''contain programming code''' in some part of the main program (most likely near the '''top''' of the program '''BEFORE''' the main program). We refer to that as a '''"function declaration"'''.
: When a program is run, the '''function's code is read into internal memory''', ready to be run when the function is '''run''' (referred to as '''calling the function'''). Until a Function is specifically told to execute, it's code will sit (in internal memory) unused.
13,420
edits