Trace two defects that mask each other

A school club sells craft kits for $3.00 each and charges one $2.00 handling fee per order. There are no taxes or discounts. The approved calculation multiplies the kit count by the unit price, then adds the handling fee.


A developer writes this Python code. The variable count already contains a positive integer supplied by the user.


Python
subtotal = count + 3.00
total = subtotal * 2.00
print(total)


Trace the code and proposed corrections. Give each requested amount in dollars, to two decimal places:

  • The total produced by the original code when count is 4.
  • The total produced by the original code when count is 5.
  • The total when count is 5 and only the first assignment is corrected to subtotal = count * 3.00.
  • The required total when count is 5 and both assignments implement the approved calculation.
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Program Development Questions: