Use print() to output data.
print("Welcome to Python!")_myVar ≠ MyVar)name = "Alice"
_name = "Valid"
1name = "Invalid"Python uses indentation (typically 4 spaces) to define blocks of code.
if 5 > 2:
print("Five is greater than two!")Incorrect:
if 5 > 2:
print("This will cause an IndentationError")Python uses the # symbol for single-line comments. Multi-line comments can be written using triple quotes.
# This is a single-line comment
print("Hello, world!") # inline comment"""
This is a multi-line string.
It can also act like a comment.
"""
print("This will still run.")No semicolons required, but allowed if needed:
x = 1; y = 2; print(x + y)Which of the following will cause a syntax error?
Hint: Check the indentation of the if statement.
Ask the AI if you need help understanding or want to dive deeper in any topic