If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Trace function calls

Problem

Erin is writing a program to calculate final prices with a discount and a surcharge applied.
def subtract_discount(price, discount):
    return price - discount

def get_final_price(price, discount, surcharge):
    discounted_price = subtract_discount(price, discount)
    return discounted_price + surcharge
She writes the following line of code to test her program:
final_price = get_final_price(50, 10, 2)
What is the final value of final_price before the program terminates?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi