In [1]:
def func():
    return 'hi'
In [2]:
func()
Out[2]:
'hi'
In [3]:
def greet(who):
    return 'Hello, {}'.format(who)
In [4]:
greet('Alice')
Out[4]:
'Hello, Alice'
In [5]:
def fibbonaci(n):
    """Compute Fibbonaci numbers"""
    if n <= 1:
        return 1
    else:
        return fibbonaci(n-1) + fibbonaci(n-2)
In [7]:
fibbonaci(7)
Out[7]:
21
In [9]:
import math
def log(n, base=math.e):
    return math.log(n) / math.log(base)
In [10]:
log(8, 2)
Out[10]:
3.0
In [11]:
log(8)
Out[11]:
2.0794415416798357
In [13]:
math.log(8)
Out[13]:
2.0794415416798357
In [ ]: