Comentarios#

Introducción#

Los comentarios en Python se utilizan para añadir explicaciones o notas dentro del código. No afectan la ejecución del código y son útiles para aclarar la lógica, documentar la funcionalidad o deshabilitar temporalmente partes del código.

Comments#

A single-line comment starts with # (spoken as “hash”) and continues until the end of the line.

# This is a single-line comment
print("Hello!")  # Print a greeting message

# Print a greeting and then a farewell
# in the Console
print("Hello!")
print("Goodbye!")

Multiline String Comments#

Triple-quoted string comments (""" """ or ‘’’ ‘’’) can be used for multiline explanations. Although they are technically string objects, they can function as comments if not assigned to a variable.

"""
This project prints a greeting message,
followed by a farewell message in the
Console
"""
print("Hello!")
print("Goodbye!")