003-001. self invoking
# @
# Method can invoke itself
# @
def hap(a, b):
print(a + b)
def gop(a, b):
print(a * b)
def hap_gop(a, b):
hap(a, b)
gop(a, b)
# hap_gop is invoking other methods rather than performing task by itself
# @
def countdown(n):
if n == 0:
print("Blastoff!")
else:
print(n)
countdown(n-1)
countdown(3)
# 3
# 2
# 1
# Blastoff!
# @
# If you use 'self invoking' well, you can build complex program easily
# But computer can have much burdens