Adding source code files for Chapter 6

This commit is contained in:
muassif
2021-03-13 19:25:45 +04:00
committed by GitHub
parent e662762d09
commit 9589675a50
45 changed files with 625 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
#inner1.py
def outer_hello():
print ("Hello from outer function")
def inner_hello():
print("Hello from inner function")
inner_hello()
outer_hello()
+14
View File
@@ -0,0 +1,14 @@
#inner2.py
def power_gen_factory(base):
def power_calc(exponent):
return base**exponent
return power_calc
power_calc_2 = power_gen_factory(2)
power_calc_3 = power_gen_factory(3)
print(power_calc_2(2))
print(power_calc_2(3))
print(power_calc_3(2))
print(power_calc_3(4))