Python 1b – Comments

Write clear single-line and multi-line comments to explain your code and improve readability.

Single-line comments

Use the # symbol to write a comment. Python ignores everything after # on that line.

# This is a comment!
print("Welcome to Python!")
# The line above prints a greeting

What gets printed?

Only code runs—comments do not. The previous example prints:

Welcome to Python!

Comments help you and others remember what each section does—especially when you revisit projects later.

Multi-line comments

For longer notes, you can use triple quotes (''' or """) as a documentation string (docstring) or block comment.

'''This is a comment that
spans multiple
lines.'''
print("Hello! How are you?")

Tip: Temporarily wrap sections of code in triple quotes to “blank out” parts while testing.

Task – Day of the week & weather

  1. Line 1: write a single-line comment saying the program prints the day of the week.
  2. Line 2: print the current day of the week.
  3. Lines 3–5: write a multi-line comment describing today’s weather.

Example solution:

# Program will print the day of the week
print("Wednesday")

'''
Weather today:
Sunny, warm, and breezy.
'''

Output: Wednesday