Hello I keep getting an error message on my Python code, that "int is not callable"

Asked by chukwuka ihemaguba on 2020-02-28

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.


# 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
    quantity_purchased = 0
    discounts = 0
    sub_total = 0
    total_discount = 0
    total = 0

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

# 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
        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

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
Eddie B (fasteddieb216) said : #1

Since this is an assignment, I'll just point you in the right direction...

- Watch out for typos like "REATIL_PRICE".
- Can a function name have the same name as a variable?
- Are you returning a value from your functions?
- Are you saving the value returned from your functions?

The error you are getting is because the function name was already defined as an INT variable.

I'm not sure why you are using so many functions. Is that part of the assignment?

chukwuka ihemaguba (chuka78) said : #2

Yes, it is. That's why it's been very difficult for me.
I'll correct the mistakes, and try it again.

Thanks a whole lot.

Can you help with this problem?

Provide an answer of your own, or ask chukwuka ihemaguba for more information if necessary.

To post a message you must log in.