You are on page 1of 17

KEY FEATURES

PROCEDURES AND FUNCTIONS


What is a procedure? Procedural programming is a method for a programmer to write computer applications. For a sub procedure it performs actions but does not return a value to the calling code. What is a function? Functions is a named section which does a specific task in an programming language programme e.g. python. It performs an action and returns a value.
This is part of a function
def power(number, exp): "prints the parameters" return number ** exp

PRE- DEFINED FUNCTIONS


What is a Pre Defined Functions ? Set of codes which will perform any standard mathematical functions in a programming language. Examples of pre-defined functions are :
Int (input("Enter the value for a")) Print ("The answer is " , ans)

LOCAL VARIABLES & GLOBAL VARIABLES


What is a Local Variable? A variable that belongs to a specific function which are called local variables. They are stored in the memory and can be changed.

This means that local variables can be accessed only inside the function which they are declared in the programme. While as global variable can be accessed throughout the program body by all its functions.

PARAMETER PASSING
What is a Parameter passing? When doing a function inside the brackets it is called a parameter. While pressing enter to run the function , it passes It on the parameter to work. An example of a parameter passing
double sales tax(double price) { return 0.05 * price; }

MODULARITY
Modular programming procedures is a common functionality which is usually grouped together into separate modules. By doing this the program can no longer consists of only one single part. Now it is divided into smaller parts which will interact through procedure calls and now form into a whole programming code.
These are modules in the document library.

PROGRAMMING LIBRARIES
In programming , a library is a collection of precompiled routines that a program can use. Sometimes the routines are called modules , which can be stored in a object format. They are very useful for storing frequently used modules so you do not have to link them to every program that uses them.

CONTROL STRUCTURES

FIXED LOOP
It is a piece of code which can repeat for a certain amount of time.

The for loop code stepping_variable = input("Enter the amount of times the loop should run ")

i = 0 for i in range (stepping_variable): print (" line to print " + str(i))

PRE - CHECK LOOP & POST - CHECK LOOP


What is a pre-check loop? It also known as a while loop. This it allows programs to repeat a series of statements over and over again, as long if the statement is true. What is a post-check? A post check loop is when the block is repeated until the specified statement is no longer true.

BREAK-POINTS
A point in a program that, when reached, triggers some special behaviour useful to the process of debugging: Breakpoints can be used to either pause program execution or dump the values of some or all of the program variables.

CONDITIONAL COMMANDS
Conditional statements allows a program to execute a certain piece of code base on a decision.

IF
What is a IF statement? An IF statement is a conditional branching statement. Example: if (expression) statement; If the expression is evaluated and found to be true , then the single statement following the If is executed. If it is false , the following statement is then skipped.

ELIF
What is a ELIF statement? An else statement can be combined with an if statement . An else statement contains the block of code which executes if the conditional expression in the IF statement resolves to 0 or a false value.

#!/usr/bin/python var = 100 if var == 200: print "1 - Got a true expression value" print var elif var == 150: print "2 - Got a true expression value" print var elif var == 100: print "3 - Got a true expression value" print var else: print "4 - Got a false expression value" print var print "Good bye!"

CONDITIONAL STATEMENTS
In programming , the programmer would want to check the conditions inside python and change the behaviour of the program.

USE OF BOOLEAN OPERATORS


Boolean operator is a subset of algebra used for true or false statements. These can be consisted of AND , NOT , OR AND = This search will find the pages that the user has typed. For example rock and jazz Not = This search finds articles that are exclusively about jazz. Or = This search finds articles that discuss either jazz or rock

It could have the same information

You might also like