FAQ: Learn Python: Syntax - Comments

This community-built FAQ covers the “Comments” exercise from the lesson “Learn Python: Syntax”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science
Data Science

FAQs on the exercise Comments

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

1 Like

2 posts were split to a new topic: Why is there no output in the terminal?

6 posts were split to a new topic: Comments about commenting

2 posts were split to a new topic: Problem in python 3?

10 posts were split to a new topic: How to make multiline comments, and autocompletion of quotes

2 posts were split to a new topic: How can I write quotes in python?

Hello, I would like to learn more about coding. Can you help me?

1 Like

Hi @kylerjennings0548088, welcome to the forums!

What would you like help with? Can you please expand on your question?

This blog has a friendly approach to programming and in the easiest language, python!


learn more and keep updated cause it’s new!

1 Like

what’s the difference between comments and documentation and when can i use them properly?

1 Like

I’m guessing that you’re curous about docstrings and comments rather than documentation (if not, see the last paragraph).

Comments are relatively straightforward though they’re less commonly used in production code and they’re generally included to help developers or anyone who actually has to read your code, e.g. explaining a particularly odd piece of code or warning about possible deprecation/incompatibility etc. etc. but they should probably be kept to a minimum. Ideally the code explains itself.

Docstrings are handy for anyone who will be using that package/module etc. as they’re intended to quickly describe the purpose of a particular piece of code and any relevant inputs and so on to allow you to use/loosely understand imported functions and classes without explicitly reading the actual source. You’ll genenrally find a docstring at the head of a module and on every function and class in any well maintained library-

If you’re intending to add them have a look at a few style guides to get a handle on how they’re often laid out and the possible options (e.g. google/numpy/epy style) and perhpas have a quick look at packages like Sphinx which are handy for making documentaton from your original code.

If you meant documentation then that can refer to quite a few things included the manuals and guidance for the language or one of the many packages that have been created for it.
e.g. official Python doccumentaiton-
https://docs.python.org/3/index.html
Third party numpy library documentation-
https://numpy.org/doc/

2 Likes

im so confused already on comments

2 Likes

Welcome to the forums!

What exactly are you confused about? Comments are meant to explain what your code is doing so that others, or your future self, can understand the code. Comments are not executed as part of the code; they are ignored.

1 Like

How do I come up with an idea for my program?

1 Like

My Python:Hello world project doesn’t want to load, :cry: . i tried resetting it but it doesn’t want to load

i asked a friend about Python and she told me that Python is not useful now, meaning almost anyone is using that. is that true?

ion know looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooool

i can’t use the print function after writing a comment. tried switching multiple lines but the computer was not reading it. the color change that marks that print function was activated was also not there. would like to ask whether it’s a system error or that print function doesn’t work after writing a comment?

Do you have formatted code to post? Or, maybe a screenshot so we can see what you’re referring to?

Perhaps I’m not completely understanding your question(?). But, for reference, you can’t print a comment. Anything that follows # is commented out and only appears in the code, not output of code.

print("this will print to the console.")   #this will not.