print() Function Correct Usage
Which FOUR of the following are correct uses of the print() function?
Quick Answer
The correct answer is the use of print('Hello') because it directly calls the print function with a single string argument, which is the most fundamental and universally accepted syntax in Python 3. This works because the print() function is designed to accept any number of positional arguments and output them to the console, with the default separator being a space and the default end being a newline. On the Certified Entry-Level Python Programmer PCEP exam, this tests your understanding of basic function invocation and the print() function's core behavior, often appearing in questions that distinguish between valid syntax and common mistakes like forgetting parentheses or using incorrect keyword arguments. A frequent trap is confusing the print function with the print statement from Python 2, so remember that in Python 3, print is always a function requiring parentheses. For a quick memory tip, think of print() as a friendly messenger that always needs its parentheses to deliver your message, and you can customize its delivery with sep, end, and file keywords.
⚠ Common exam trap
Python Institute often tests the distinction between Python 2's print statement (no parentheses) and Python 3's print function (requires parentheses), leading candidates to mistakenly select option A as valid.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
print('Hello', 'World', sep='-')
Options B, C, D, and E are all correct uses of the print() function in Python 3. Option B demonstrates the use of the sep parameter to set a custom separator between arguments. Option C shows printing two string arguments separated by the default space. Option D shows printing a single string. Option E shows printing a string and an integer, which is perfectly valid; the print() function automatically converts non-string arguments to strings. Option A is incorrect because it uses the Python 2 print statement syntax (missing parentheses) and will raise a SyntaxError in Python 3.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
print 'Hello'
Why it's wrong here
Incorrect. Omits parentheses, which is the Python 2 print statement syntax, not the Python 3 function.
- ✓
print('Hello', 'World', sep='-')
Why this is correct
Correct. The sep parameter sets a custom separator between arguments.
- ✓
print('Hello', 'World')
Why this is correct
Correct. Prints two string arguments separated by the default space.
- ✓
print('Hello')
Why this is correct
Correct. Prints a single string.
- ✓
print('Hello', 5)
Why this is correct
Correct. The print() function can handle mixed types; it automatically converts non-string arguments to their string representation.
Go deeper
Related to this question
About these practice questions
One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on PCEP
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Order the steps to debug a Python script using print statements.
medium- ✓ A.1. Insert print statements, 2. Run the script, 3. Analyze the output, 4. Remove print statements
- B.1. Insert print statements, 2. Remove print statements, 3. Run the script, 4. Analyze the output
- C.1. Run the script, 2. Insert print statements, 3. Analyze the output, 4. Remove print statements
- D.1. Analyze the output, 2. Insert print statements, 3. Run the script, 4. Remove print statements
Why A: Debugging with print involves inserting prints, running, analyzing, and cleaning up.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.