Modules and Scripts

problems

>>> repeat(lambda x: 2*x, 1, 5)
32

twice(twice(twice(twice(twice(1)))))

>>> f = lambda x:2*x
>>> g = lambda x:x*x
>>> fg = compose(f, g)
>>> fg(2) ## f(g(2))
8

Modules and Scripts

Problems

Writing your own modules

Any python file (.py) in current working directory can be imported as python module. If the py file that you want to make use of is not in current working directory, then you set the folder path when the file is, as PYTHONPATH.

Writing scripts

scripts are .py files but it has got more than just definations