Skip to main content

Python

General

How do you write a single-line comment?

Use the pound sign

# This is a single-line comment
How do you write a multi-line comment?

Use the pound sign for each line or you can surround the comment in a set of three quotation marks.

# First line of a multiline comment.
# This is the second line.

"""
This is the first line of a multiline comment.

Here is another line.
"""
What are the parts of a Python If...Else statement?
if condition:
statements
elif condition:
statements
else:
statements
How would you write "Hello world!" to the console?
print("Hello world!")