Back
Close

Beginner Python Concepts

a-Rye
12.9K views

Comments

Comments are very useful in programming. If you're coding for work or to be published, you'll want to explain your code with comments. You can also use comments in debugging to investigate your code further.

# This is a single line comment. Any line that starts with a # will be seen as a comment by the compiler / interpreter / computer. 

'''
This
is
a
multi
line
comment
'''

"""
This
is
also
a 
multi
line
comment
"""

# It gets a weird value here, still not sure why?

Disabling parts of your code

Sometimes, you just want a part of your code to stop temporarily. I often find myself doing this when trying to optimize my code or when trying to single out a corner case in my code.

Let's take that mass of code from the previous page and try looking at each piece individually.

Try "turning pieces on and off again"!
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants