1234567891011121314151617181920212223 |
- #!/usr/bin/env python3
- """ A simple example of function declarations and main. """
- def example(firstargument, secondargument, thirdargument="N/A"):
- """ Prints a string based on the two arguments. """
- # This is python3.6 syntax:
- # print(f"{firstargument} is the first argument.")
- print("{a} is the first argument.".format(a=firstargument)) # Name the argument if you want
- print("{} is the second argument.".format(secondargument))
- print("{} is the third argument.".format(thirdargument))
- if __name__ == "__main__":
- """
- Some examples on simple functions.
- And docstring stuff that will probably have to be updated when I know more.
- """
- # You can just use parameters in order
- example("My first argument", "my second argument")
- # but better to use the names, without spaces here!
- example(secondargument="#2!", firstargument="#1!", thirdargument="#3!")
|