Professional Documents
Culture Documents
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 ")
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.