Creating our own library
We can create our own library. Its functionality can be used in other Python programs and in the REPL tool. Let’s try that. Save the following program with the name mylib.py
on your local computer:
def message(): print("Then out spake brave Horatius,") print("The Captain of the Gate:") print("\"To every man upon this earth") print("Death cometh soon or late.") print("And how can man die better") print("Than facing fearful odds,") print("For the ashes of his fathers,") print("And the temples of his Gods.\"") if __name__ == '__main__': message()
The if
condition here is to check if we care about running the program directly or calling it...