python function is not executing

Sunday, May 4, 2014

Hi i am new to python so i am facing bit problem in the code . i have some functions but tota_additional_bonus() and total_bonus these function are not working i think because it does not shows the print values . so kindly help me



enter code here

import sys
def compute(sale,persent): #function to compute bonus
return(sale*persent/100)
while (1):
try:
print ("Enter Sales Price For Toyata $")
toyota=int(input())
print ("Enter Sales Price For Nissan $")
nissan=int(input())
print ("Enter Sales Price For Ford $")
ford=int(input())

print ("Enter Number Of Sales For Toyata in 2014")
to=int(input())
print ("Enter Number of Sales For Nissan in 2014")
ni=int(input())
print ("Enter Number Of Sales For Ford in 2014")
fo=int(input())



except ValueError:
print ("Enter An Integer")
sys.exit()

sales= ((toyota*to)+(nissan*ni)+(ford*fo)) #calculating total sales of abc



ct=(toyota*to) # total sells toyata
cn=(nissan*ni) # total sells nissan
cf=(ford*fo) # total sells toyata

print ("Contribution Of Toyota $",ct,"in Total Sales")
print ("Contribution Of Nissan $",cn,"in Total Sales")
print ("Contribution Of Ford $",cf,"in Total Sales")
print ("Total Sales for ABC",sales)

if sales <= 500000:
bonus=compute(sales,0.1)

elif sales >=500001 and sales <=1000000:
bonus=compute(sales,0.2)+500

elif sales >=1000001 and sales <=5000000:
bonus=compute(sales,0.3)+1500

elif sales >=500001 and sales <=10000000:
bonus=compute(sales,0.4)+13500
elif sales >10000000:
bonus=compute(sales,0.5)+33500

print ("Total Bonus\n",bonus) #total bonus

cty=(ct*bonus)/sales #bonus contribution toyata
cny=(cn*bonus)/sales #bonus contribution nissan
cfy=(cf*bonus)/sales #bonus contribution toyata

print ("Contribution Of Toyota $",cty,"in Total Bonus")
print ("Contribution Of Nissan $",cny,"in Total Bonus")
print ("Contribution Of Ford $",cfy,"in Total Bonus")


print ("Input the Additional bonus for toyota in %")
x=int(input())
print ("Input the Additional bonus for Nissan in %")
y=int(input())
print ("Input the Additional bonus for Ford in %")
z=int(input())


def additionalbonus(bonus,extra): #function to calculate additional bonus
return (bonus*extra)
xn= additionalbonus(bonus,x)
yn= additionalbonus(bonus,y)
zn= additionalbonus(bonus,z)


print("Additional Bonus for toyota",xn)
print("Additional Bonus for nissan",yn)
print("Additional Bonus for ford",zn)


def tota_additional_bonus(xn,yn,zn): #calculating total additional bonus
t_n = xn +yn + zn
print ("Total Adiitional Bonus is",t_n)

def tota_bonus(bonus,t_n): #calculating total bonus distributed by ABC
bonus_n=bonus+t_n
print ("Total Bonus distributed is",bonus_n)

print ("Enter Y to Calculate for another Year or N to Exit")
var= input()

if var == 'y':
pass
elif var == 'n':
exit()


input()







http://ift.tt/1fH36nW