Estimated time
5-10 minutes
Level of difficulty
Very easy
Objectives
- Becoming familiar with the
print()function - Experimenting with Python code
Scenario
The print() command simply prints a line to the screen. Complete the 5 tasks below in order.
Expected output or result
Hello, Python!Tasks
Task 1 — Print
Hello, Python! with double quotesWhat to do: On the first available code line, print
Hello, Python! using print() with double quotes.3 pts
Task 2 — Print your first name
What to do: Press Enter after the Task 1 statement, then on the next line use
print() to display your first name.3 pts
Task 3 — Trigger a
NameError by removing quotesWhat to do: On the existing first-name line, remove the quotes from inside
print() to cause a NameError; do not add another line.2 pts
Task 4 — Trigger a
SyntaxError by removing parenthesesWhat to do: On the current line, type
print "Hello" without parentheses to cause a SyntaxError; do not add another line.2 pts
Task 5 — Use single quotes and two
print() statementsWhat to do: Replace the current code with two lines: type one
print() statement, press Enter, then type the second print() statement on the next line; use single quotes in at least one.4 pts
main.py
1
Console
Ready. Click Run to execute your code.
AI Tutor
Powered by Claude
AI
Welcome! Loading...
What does print() do?
Why quotes?
SyntaxError?
NameError?
Single vs double quotes