← Back to team overview

sikuli-driver team mailing list archive

[Question #689036]: Hello I keep getting an error message on my Python code, that "int is not callable"

 

New question #689036 on Sikuli:
https://answers.launchpad.net/sikuli/+question/689036

Hello everyone,
                            I was working on an assignment, and I kept getting an error message that the "int" function is not callable.
Please take a look at my code below; let me know where I went wrong.

Thanks



# This program requests the number of packages bought.
# Then it calculates the discount based on the stipulation.
# And then the program displays the discount amount, and
# the total amount after the discount.


# Define the "main" function
def main():
    # Declaration
    RETAIL_PRICE = 99
    quantity_purchased = 0
    discounts = 0
    sub_total = 0
    total_discount = 0
    total = 0

    # Call on the sub-functions
    quantity_purchased = Input_quantity()
    discounts()
    sub_total(RETAIL_PRICE, quantity_purchased)
    total_discount(sub_total, discount)
    total(sub_total, total_discount)
    print_SDT()


# Define the "Input_quantity" function
def Input_quantity():
    #Get the quantity of purchased packages from user
    quantity_purchased = int(input('Quantity purchased: '))
    return quantity_purchased


# Define the "" function
def discounts():
    # Calculate the discounts
    if quantity_purchased < 10:
        discount = 0    # No discount
    elif 10 <= quantity_purchased and quantity_purchased < 20:
        discount = 0.1    # 10% off
    elif 20 <= quantity_purchased and quantity_purchased < 50:
        discount = 0.2    # 20% off
    elif 50 <= quantity_purchased and quantity_purchased < 100:
        discount = 0.3    # 30% off
    else:
        discount = 0.4    # 40% off


# Define the "sub-total" function
def sub_total (REATIL_PRICE, quantity_purchased):
    sub_total = RETAIL_PRICE * quantity_purchased


# Define the "total_discount" function
def total_discount(sub_total, discount):
    total_discount = sub_total * discount


# Define the "total" function
def total(sub_total, total_discount):
    total = sub_total - total_discount

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.