Testing, Testing, is This Thing On? What should the comments look like?


Ok, this is my question:

Who are the comments for? Here are the comments I put in:"""welcome to the pig latin translator. Just enter your name at the prompt and it gives it back to you in pig latin!"""

But then I realized that comments should be for the people who come across your code so they can see what you did.
I'm not sure how to describe the code.
Can you give me an example of what those comments should look like?



If you wish to communicate with the user, use print. It is possible to expose comments as heredoc (preformatted text):

comment = """
    This text is preformatted
    and stored as a heredoc
    with formatting preserved
print comment

Normally, a simple print statement is sufficient for prompting.

Comments can come in two forms:

  1. Single line comments are prefaced with #
  2. Multi-line comments are wrapped in triple quotes, ''' or """