From 0fe49fc5d82f1b384dd62f19cd1f8533cd483a57 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Sat, 9 Aug 2014 23:30:53 +0530 Subject: [PATCH] mymodule example code. --- code/mymodule/__init__.py | 4 ++++ code/mymodule/bars.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 code/mymodule/__init__.py create mode 100644 code/mymodule/bars.py diff --git a/code/mymodule/__init__.py b/code/mymodule/__init__.py new file mode 100644 index 0000000..bff9604 --- /dev/null +++ b/code/mymodule/__init__.py @@ -0,0 +1,4 @@ +import mymodule.bars as bars +from mymodule.bars import simplebar +__all__ = [bars, simplebar] + diff --git a/code/mymodule/bars.py b/code/mymodule/bars.py new file mode 100644 index 0000000..8a2f1b6 --- /dev/null +++ b/code/mymodule/bars.py @@ -0,0 +1,37 @@ +""" +Bars Module +============ + +This is an example module which provides different ways to print bars. + +""" + +def starbar(num): + """ + Prints a bar with * + + :arg num: Length of the bar + + """ + print('*' * num) + +def hashbar(num): + """ + Prints a bar with # + + :arg num: Length of the bar + + """ + print('#' * num) + +def simplebar(num): + """ + Prints a bar with - + + :arg num: Length of the bar + + """ + print('-' * num) + +if __name__=='__main__': + simplebar(20)