Courseiva

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

A cashier script stores a discount rate and a price, then computes the final amount. The developer writes:

rate = 0.15 price = 200 final = price - price * rate

print(final)

What is printed?

⚠ Common exam trap

The trap here is treating the discount product as the final answer or expecting an integer output despite a float operand in the expression.

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

✓

170.0

Python evaluates multiplication before subtraction, so price * rate is computed first as 200 * 0.15, giving 30.0. That product is then subtracted from price, yielding 170.0. Because one operand is a float, the final result is a float and is displayed with a decimal point, distinguishing it from an integer 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.

  • ✗

    30.0

    Why it's wrong here

    30.0 is the discount amount obtained from price * rate alone, not the final price after subtracting it. The expression subtracts that product from the original price, so the result is larger than the discount. Selecting this value means the precedence of subtraction relative to multiplication was misread.

  • ✓

    170.0

    Why this is correct

    Multiplication is evaluated before subtraction, so price * rate computes 200 * 0.15, which equals 30.0. Subtracting that from 200 gives 170.0. Because rate is a float, Python promotes the entire expression to float, so the printed value includes the decimal point even though the fractional part is zero.

  • ✗

    200.15

    Why it's wrong here

    This result would appear only if the code added the rate to the price, which it does not. The expression multiplies price by rate and subtracts that product from price. Misreading the operators or ignoring operator precedence leads to this incorrect value.

  • ✗

    170

    Why it's wrong here

    170 is the integer result a developer might expect if the discount were 15 percent of 200 expressed with integer arithmetic. However, rate is a float, so the product 200 * 0.15 is 30.0 and the subtraction yields a float. Integer formatting does not apply automatically to float results.

About these practice questions

This PCEP question is part of Courseiva's 482-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Python Institute exam blueprint

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.