From 15947288153b8780c64c1c84cec81d37a2d1ca39 Mon Sep 17 00:00:00 2001 From: Michael G <44246042+mikejgurch@users.noreply.github.com> Date: Mon, 4 Mar 2019 17:04:25 -0600 Subject: [PATCH] Added some Sample Code for a demonstration in article commenting-code (#28451) Implemented some Sample Code for the reader so they can see how comments are used in a basic function. --- guide/english/python/commenting-code/index.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/guide/english/python/commenting-code/index.md b/guide/english/python/commenting-code/index.md index ba665a517c..20b83e714c 100644 --- a/guide/english/python/commenting-code/index.md +++ b/guide/english/python/commenting-code/index.md @@ -45,4 +45,16 @@ For a string literal to be a docstring, it must start and end with `"""` and be pass ``` -String literals that start and end with `"""` that are not docstrings (not the first statement), can be used for multiline strings. They will not become `__doc__` attributes. If they are not assigned to a variable, they will not generate bytecode. There is some discussion about using them as multiline comments found [Multiline Comments in Python - Stack Overflow](http://stackoverflow.com/questions/7696924/multiline-comments-in-python). +String literals that start and end with `"""` that are not docstrings (not the first statement), can be used for multiline strings. They will not become `__doc__` attributes. If they are not assigned to a variable, they will not generate bytecode. There is some discussion about using them as multiline comments found here. + +## Sample Code +```python + def print_greeting(name): + """This function will print a greeting to a friend.""" + + # prints the greeting with the name + print("Howdy, " + str(name) + "!") + + print_greeting("John") + >>> Howdy, John! + ```