Menu
CoddyTech

Print, Comments, and Strings

Lesson 2 of 48 in Coddy's Python for JavaScript Developers course.

Print readable messages and keep comments out of program output.

JavaScript

// A note for the reader
console.log("Status:", "ready");
console.log("Don't stop");

Python

# A note for the reader
print("Status:", "ready")
print("Don't stop")

What changes

Both complete programs print the same two lines. Python calls print directly rather than accessing console.log. With several arguments, print places a space between them and ends the line with a newline. A single-quoted or double-quoted literal creates a string; choose the surrounding quotes so the text is easy to read. The quotes delimit the value and do not appear in output. Python starts a line comment with #. It continues to the end of that source line. A hash inside quotes remains ordinary text. These examples do not need JavaScript-style semicolons.

Common mistake

Do not copy // as a Python comment marker: it is an arithmetic operator. An apostrophe inside single quotes must be escaped, or you can use double quotes around the whole string. Extra debugging output also changes the answer that a challenge checks.

Your task

Keep the provided line-reading expression, disable the diagnostic, and print the required second line. Input text is data, so quotes and hashes within it must survive unchanged.

challenge icon

Challenge

Beginner

Input is one line of text, which may be empty or contain quotes or #. Print Message:, one space, and that exact text on the first line. Print It's Python on the second line. Remove or comment out the diagnostic print in the starter. input() is supplied here to read one line without its final newline.

Print only the requested output, with a newline after each line. The supplied input lines read the test data; keep them and add your work below.

Your code goes in main.py. The locked driver.py starts your program and cannot be edited.

Try it yourself

# Starts the program in main.py. Edit main.py to solve the challenge.
from runpy import run_module

run_module("main", run_name="__main__")
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Python for JavaScript Developers

Practice on your own: Online Python compiler