Reusability
- How to make set of instructions written to be reused.
Find all the multiples of 3 below 100
- Operator Set: + – * / % == <= >= < >
- Solution 1
index = 1
muliple = 3
max = 100
until mulitple * index <= 100
print mulitple * index
index = index + 1
end
- Solution in python
def multiples(multiple, max):
index = 1
while multiple * index <= max:
print(multiple*index)
index = index + 1
print("multiples of 3 till 100 are ")
multiples(3, 100)
print("multiples of 5 till 200 are ")
multiples(5, 200)
-
Debugging Hint:
- Step Over : Execute the current statement and move to the next statement
- Step Into : Get inside the function and execute from there
- Breakpoint: Statement where the execution is stopped for manual debugging.
-
Each Python file is called as module.
-
Functions in one python module can be used in other python modules by importing modules.