Comments and errors
Section 1: The startLesson 1.3 · ⏱ 6 min
A line that starts with # is a comment: a note for you, and the computer ignores it.
# this line is a comment
print("Robo") # a comment at the end of a line
🖥️ The output in Robo Python:
🐍 Open the code in Robo Python ↗Robo

If you make a mistake, like forgetting a quotation mark, an error appears in red with the line number. Read the message, go back to the line and fix it. Mistakes are part of learning.
📌 Another example: a comment that explains
Python doesn't run a line that starts with #. We write an explanation for ourselves in it.
# this line is a comment: Python skips it
print("Hello") # a comment can also come after the code
# print("this will not be printed")
🖥️ The output in Robo Python:
🐍 Open the code in Robo Python ↗Hello
✍️ Practise
Try the lesson's examples here: copy the code, change it, and click ▶ Run.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Write a comment above print that explains what it does.
👀 Show the solution🙈 Hide the solution
# say hello to the class
print("Hello class")
🖥️ The output in Robo Python:
🐍 Open the code in Robo Python ↗Hello class
Result: only Hello class, and the comment doesn't appear.
Medium
The code has a mistake: print("Hi). Fix it.
👀 Show the solution🙈 Hide the solution
print("Hi")
🖥️ The output in Robo Python:
🐍 Open the code in Robo Python ↗Hi
Result: a quotation mark was missing.
Hard
The code has a mistake: Print("Hi"). Fix it.
👀 Show the solution🙈 Hide the solution
print("Hi")
🖥️ The output in Robo Python:
🐍 Open the code in Robo Python ↗Hi
Result: print is written in small letters.

