Keywords Parameter Function Procedure Argument Variable Programming Techniques

Keywords Parameter, Function, Procedure, Argument, Variable, Programming Techniques Sub Programs

Why use sub programs? Objectives BEGINNER: Define a sub program in computing. ADVANCED: Explain functions, procedures, parameters and arguments. EXPERT: Develop a program that uses a function. Sub programs can be used to save time and simplify code. The main types of sub programs are procedures and functions. When you want your program to repeat in different places you only need to call the name of the sub program. This saves time and simplifies code by avoiding repetition of code.

Procedure Objectives BEGINNER: Define a sub program in computing. Procedures are sets of instructions stored under one name (identifier). ADVANCED: Explain functions, procedures, parameters and arguments. EXPERT: Develop a program that uses a function. If we call name() and input Jon it would output: Hello Jon

Function Objectives BEGINNER: Define a sub program in computing. ADVANCED: Explain functions, procedures, parameters and arguments. EXPERT: Develop a program that uses a function. Functions are similar to procedures but always return a value to the main program.

Parameter and Arguments Objectives BEGINNER: Define a sub program in computing. ADVANCED: Explain functions, procedures, parameters and arguments. EXPERT: Develop a program that uses a function. A Parameter is a special name given to a variable that is passed into a sub function. It is worth noting that both procedures and functions can take in parameters. An argument is the name given to the actual values when the sub program is called.

Task Objectives BEGINNER: Define a sub program in computing. ADVANCED: Explain functions, procedures, parameters and arguments. Write a function called Grade. Calculator() that converts an exam result to a grade using the following boundaries: 90 -100 = A* 80 -89 – A 70 – 79 – B 60 – 69 – C <60 - Fail EXPERT: Develop a program that uses a function. Can you create pseudo code and then write the program in python?
- Slides: 6