Level015 1
Level015 1
Level015 1
python3
"Working in The Scope of Global Scope(Program Level)"
import os
os.system("cls")
print("\n----------------GLOBAL SCOPE BEGINS HERE-----------------", end = "\n")
def outerFunction() :
"Working in The Scope of Outer Function(Enclosed Scope)"
print("\n----------------ENCLOSE SCOPE BEGINS HERE-----------------", end =
"\n")
print("\nAssigning The Variable in Enclosed Scope(outerFunction)", end = "\
n")
outerVariable = 10
def innerFunction() :
"Working in The Scope of Inner Function(Local Scope)"
print("\n----------------LOCAL SCOPE BEGINS HERE-----------------", end
= "\n")
print("\nAssigning The Variable in Local Scope(innerFunction)", end =
"\n")
innerVariable = 20
print("\nAdding The Local Scope Variable With Enclose Scope Variable",
end = "\n")
innerResult = outerVariable + innerVariable
print("\nReturning The innerFunction() Through Return Statement at
Local Scope(innerFunction)", end = "\n")
print("\n----------------LOCAL SCOPE ENDS HERE-----------------", end =
"\n")
print("\n----------------ENCLOSE SCOPE ENDS HERE-----------------", end
= "\n")
return innerResult
import os
os.system("cls")
def baseFunction() :
"This is The Base Function in The Application"
print("\nHello! This is The Message From The Base Function", end = "\n")
def callingFunction(callBase) :
"This is The Calling Function To Base Function in The Application"
print("\nHello! This is The Message From The Calling Function", end = "\n")
return callBase()
#! python3
import os
os.system("cls")
def makeUpperCase(inStringFunc) :
def changeUC() :
extrString = inStringFunc()
return extrString.upper()
return changeUC
def outMessage() :
return "we are emotional generation"
import os
os.system("cls")
def makeUpperCase(inStringFunc) :
def changeUC() :
extrString = inStringFunc()
return extrString.upper()
return changeUC
@makeUpperCase
def outMessage() :
return "we are emotional generation"
#! python3
import os
os.system("cls")
def calcDivision(inNum, inDeno) :
return inNum / inDeno
#! python3
import os
os.system("cls")
def divValidate(inDivFunc) :
def evalDivision(inNumerator, inDenominator) :
if inDenominator == 0 :
return "Sorry! Division Cannot Proceed With Denominator as Zero"
return inDivFunc(inNumerator, inDenominator)
return evalDivision
@divValidate
def calcDivision(inNum, inDeno) :
return inNum / inDeno
import os
os.system("cls")
def getUpperCase(inDecoFunc) :
def innerUC() :
inUpperString = inDecoFunc()
return inUpperString.upper()
return innerUC
def applySplit(inDecoFunc) :
def innerSP() :
inSplitString = inDecoFunc()
return inSplitString.split()
return innerSP
@applySplit
@getUpperCase
def callingFunction() :
"This is The Calling Function"
inFullName = input("\nPlease Give Your Full Name : ")
print("\nThe Actual Name Given is : ", inFullName, end = "\n")
return inFullName
print("\nMain Module of The Application Begins Here", end = "\n")
print("\n------------------------------------------")
print("\nThe Returned Decorated Name is : ", callingFunction(), end = "\n")
#! python3
import os
os.system("cls")
def getUpperCase(inDecoFunc) :
def innerUC() :
print("\nWe Are in The Upper Decorator", end = "\n")
inUpperString = inDecoFunc()
return inUpperString.upper()
return innerUC
def applySplit(inDecoFunc) :
def innerSP() :
print("\nWe Are in The Split Decorator", end = "\n")
inSplitString = inDecoFunc()
return inSplitString.split()
return innerSP
@applySplit
@getUpperCase
def callingFunction() :
"This is The Calling Function"
inFullName = input("\nPlease Give Your Full Name : ")
print("\nThe Actual Name Given is : ", inFullName, end = "\n")
return inFullName
#! python3
import os
os.system("cls")
def callUpper(inFullName) :
def getUpperCase(inDecoFunc) :
def innerUC() :
return inDecoFunc().upper()+ " " + inFullName.upper()
return innerUC
return getUpperCase
@callUpper("Sathish Yellanki")
def callingFunction() :
"This is The Calling Function"
return " Welcome To The World of Artificial Intelligence"