B4Coder
0%
LessonAbout 4 min

Chapter 1 · Lesson 3 of 5

03. Notes for people

Lines that start with # are comments: notes for people reading your code, which Python skips.

Code is read by people as well as computers: your teacher, your team, or you next week. A comment is a note for them. It starts with #, and Python skips everything from the # to the end of the line.

Python
# Greets the classprint("Good morning!")  # shown first# print("This line is switched off")print("Let's begin.")

It shows

Good morning!
Let's begin.

Your turn

1Steps

  1. 1This program prints one line too many. Don't delete anything: turn the line that prints Oops! into a comment, so the program prints just the two other lines.

Starting code

The editor starts empty. Copy this into it to begin, or write your own from scratch.

Python
print("Step 1: open the box")print("Oops!")print("Step 2: take out the robot")

2Expected output

It should show

Step 1: open the box
Step 2: take out the robot

3Hints

Stuck? Open one hint at a time: each gives a bit more help.

Hint 1

A comment starts with one special character, and Python skips the rest of that line.

Hint 2

Put that character at the very start of the line with Oops! on it.

Hint 3

Make the middle line: # print("Oops!")

Terminal

Click Run to see what your program shows, then Submit answer to check it and unlock Next.