Page 7 - LN
P. 7
Lesson Note
def SimpleInterest(P, R=3, T=5)
Valid function call statements are:
SimpleInterest(2000, R=5)
SimpleInterest(2000, T=7)
Imp:
Positional arguments after keyword argument will result error.
Scope of variables
Scope of variables refer to the part of the program where it is visible i.e. the area where you can
refer (use) it. Scope holds current set of variables and their values.
Two kinds of scope in Python are:
1) Global Scope – A name declared in the top level segment (_main_) of a program is said to
have a global scope and is usable inside the whole program and all blocks (functions and
other blocks) of the program
2) Local Scope – A name declared in a function body including parameter list is said to have a
local scope and can be used/accessed within the function (including blocks/functions within
it) only.