Home > Mobile >  how to do accumulative sales amount and bonus amount in python [has an answered]
how to do accumulative sales amount and bonus amount in python [has an answered]

Time:01-08

I try to do accumulative sales amount and bonus amount but then I can't get the output. [has an answered]

Here is my full code.

def income():
    sales = float(input("Input your anual sales: "))
    salary = 4000
    if sales >= 10000:
        bonus = 0.1
        salesbonus = sales * bonus
        totalsalary = salary   salesbonus
        print(f"Your total salary this month is RM{totalsalary}")
    else:
        bonus = 0
        print(f"Your total salary this month without bonus is RM{salary}")
    totalsales = float(input("Input your accumulative sales: "))
    accumulative_salary = 0.1 * totalsales
    if totalsales >= 100000:
        totalbonus = 0.2
        total_sales = totalbonus * totalsales
        total_salary = total_sales   accumulative_salary
        print(f"Your accumulative salary with bonus is RM{total_salary}")
    else:
        totalbonus = 0
        print(f" Your accumulative salary "
              f"without bonus is RM{accumulative_salary}")

    print("Congratulations! Thank you for your performing. "
          "Keep positive and move forward.")


income()

CodePudding user response:

def income ():

sales = float(input("Input your anual sales: "))
totalsales = float (input("Input your accumulative sales: "))
salary = 4000

if (sales>=10000):        
    print (f"Your total salary this month is RM {salary   (sales * 0.1)}")
else :
    print (f"Your total salary this month without bonus is RM {salary}")    

if (totalsales>=100000):
    print (f"Your accumulative salary with bonus is RM {(totalsales * 0.2)   (totalsales   (0.1*totalsales))}")
else :
    print (f" Your accumulative salary without bonus is RM {0.1*totalsales}")

return "Congratulations! Thank you for your performing . Keep positive and move forward."
  •  Tags:  
  • Related