Python True Division (/) Operator
Exhibit
Refer to the exhibit. >>> x = 4.5 >>> y = 2 >>> print(x // y)
What is the output?
Quick Answer
The correct output is 2.25. This result comes from Python’s true division operator (/), which always returns a float, even when dividing two integers. In the expression 9 / 4, Python 3 performs floating-point division, yielding 2.25 rather than truncating to 2. On the Certified Entry-Level Python Programmer PCEP exam, this question tests your understanding of the fundamental difference between true division (/) and floor division (//). A common trap is assuming integer division produces an integer result, as it does in Python 2 or with the // operator. Remember: the single slash always gives a float, so 9 / 4 is never 2—it is always 2.25. For a quick memory tip, think “True division = Float forever.”
⚠ Common exam trap
Candidates often mistakenly think that `/` performs floor division or that the result is truncated to an integer. However, in Python 3, `/` always returns a float, and `9/4` yields 2.25, not 2.0 or 2.
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
✓
2.25
In Python 3, the `/` operator performs true division, which always returns a float. The expression `9 / 4` divides 9 by 4, resulting in 2.25. Option A correctly states this result.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
2.25
Why this is correct
Evaluating `9 / 4` with true division yields the float 2.25, since Python 3's `/` operator always returns a float regardless of operand types. The stem's expression therefore prints 2.25, satisfying the requirement that integer division truncation does not apply here.
- ✗
Error
Why it's wrong here
The snippet raises no exception, so no error is produced; the code executes and returns a value. Error is tempting because the syntax looks unusual, and would be correct if the code referenced an undefined name or passed an invalid argument type to a built-in.
- ✗
2.0
Why it's wrong here
Floating-point division in Python 3 returns a float, so 4/2 yields 2.0, not the integer 2 — but the stem's operands determine the actual result. This option is tempting when integer division is assumed, which would be the correct choice if the expression used the // operator instead.
- ✗
2
Why it's wrong here
The expression evaluates to a different value, so 2 is not printed. It is tempting because 2 appears as an intermediate operand in the arithmetic, and would be correct if the question asked for that intermediate result rather than the final output.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 482 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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. A programmer writes: x = 5; y = 2; result = x / y. What is the type of result?
medium- A.int
- ✓ B.float
- C.str
- D.complex
Why B: In Python 3, the division operator (/) always returns a floating-point number, even if both operands are integers. Since x and y are both integers (5 and 2), the result of 5 / 2 is 2.5, which is of type float. Therefore, option B is correct.
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.